We’ll now go through multiple business problems and solve them using appropriate Declarative tools.
You want to make sure that each new user that is created in your Salesforce org is active so that the user can log in to Salesforce as soon as the user is created.
We can achieve this functionality using a simple Workflow Rule.
Let me show you step by step how to implement this solution using Workflow rule.
Log in to you Salesforce org and click on the gear icon on the top right. Follow the icons or steps that I’ve marked with red lines in the UI screenshots.
After clicking on the gear icon, you would find an option called Setup. Click on Setup.
In the Quick Find box on the left, type ‘Workflow Rules’, you’ll see suggestions appearing below the Quick Find box. Click on ‘Workflow Rules’
You’ll now see a list of existing Workflow rules in your org along with option to create a new one. Click on ‘New Rule’ button.
We need to select the object on which our workflow would be focused. In this case our scenario is based on User object and hence we need to select object as ‘User’. Click ‘Next’.
Enter a Name for your Workflow rule, in this case ‘User Workflow’ and give an appropriate description of what your workflow rule would do. Select the Evaluation criteria as ‘Created’ since we want our rule to be evaluated when a new User record is created. Click ‘Next’.
In the Rule criteria, select the Field ‘Active’, operator as ‘equals’ and Value as ‘False’. Through this step, we are checking if the Active field in User record while getting created is not selected as true.
Note: Active is a checkbox field i.e., the value can either be true or false.
You could also check the values for other fields and add in the rule criteria depending on your business scenario.
Click on the ‘Save & Next’ button.
Now that our rule criteria has been set, we need to define the action to be performed if this rule criteria evaluates to true.
You can see the Rule and Evaluation criteria that you’ve set up.
Under the headline ‘Immediate Workflow Actions’, click on the button ‘Add Workflow Action’ to add the action ‘New Field Update’. We chose this action since we want to update the Active field in User record as true.
A field update wizard would reflect on the screen. Enter the Name and Unique Name and select ‘Active’ in the ‘Field to Update’. Under the heading ‘Specify New Field Value’, select ‘True’ in Checkbox Options.