Create a Workflow
Create a Process
The last business rule functionality you will implement before testing your application is a rule to set the Out-of-State checkbox field on the Travel Approval object if out-of-state travel has been chosen. Salesforce provides workflow capabilities that provide a declarative, drag-n-drop design environment to build our business process logic. The Salesforce Lightning Process Builder lets you automate the following.
- Create or update a record
- Send an email alert
- Invoke a visual flow which includes a user interface
- Post to Chatter to alert followers of a record or to record some event
- Invoke a subprocess
- Submit a record for approval
- Invoke Apex code for highly customized logic implemented in a programming language
Let’s now create a process that uses the update record process builder action to set the out-of-state flag.
- From Setup, click the Home tab.
- Select Process Automation | Process Builder (or use the Quick Find and search for
Process Builder
). You should see a window like the following:
- Click New.
- Enter the following values.
Parameter
Value
Process Name
Set Out of State Travel Flag
API Name
Set_Out_of_State_Travel_Flag
(This automatically gets set when you tab out of the Process Name field)
Description
Leave blank
The process starts when
A record changes
- Click Save.
- Click +Add Object to configure the object you want this processing rule to run on when a record is created or modified.
- Enter the following values.
Parameter
Value
Object
Travel Approval
Start the process
When a record is created or edited
Advanced
Do not change
- Click Save.
Add Your Criteria
Next, we'll add some criteria to the process.
- Click Add Criteria.
- Enter the following values.
Parameter
|
Value
|
---|---|
Criteria Name
|
Out of State Travel
|
Criteria for Executing Actions
|
Conditions are met
|
Field | Destination State |
Operator | Does not equal |
Type | String |
Value | TX |
Conditions
|
All of the conditions are met (AND)
|
Advanced
|
Do not change
|
Here's what it should look like.
3. Click Save.
Add an Action
Next, we'll add an action to the process.
- Click Add Action in the Immediate Actions section.
- Enter the following parameters.
Parameter
Value
Action Type
Update Records
Action Name
Set out of state checkbox field
Record Type
Select the Travel_Approval__c record that started your process
Criteria for Updating Records
No criteria-just update the records!
Set new field values for the records to update
Out-of-State Type Boolean Value True
Here's what it looks like.
3. If everything looks good, click Save. You have now configured a business process that sets the Out-of-State checkbox for any travel outside your agency's state.
4. The last thing to do is click Activate, then click Confirm.
Process Builder is a powerful, yet simple tool, that you use to automate many actions within your Salesforce Applications. Next, you learn how to build an approval process for any Salesforce record.