Erfassen Sie Ihre Fortschritte
Trailhead-Startseite
Trailhead-Startseite

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.

  1. From Setup, click the Home tab.
  2. Select Process Automation | Process Builder (or use the Quick Find and search for Process Builder). You should see a window like the following:
    Process Builder page
  3. Click New.
  4. 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
  5. Click Save.
  6. Click +Add Object to configure the object you want this processing rule to run on when a record is created or modified. Process Builder for Set Out of State Travel Flag
  7. Enter the following values.
    Parameter
    Value
    Object
    Travel Approval
    Start the process
    When a record is created or edited
    Advanced
    Do not change
  8. Click Save.

Add Your Criteria

Next, we'll add some criteria to the process.

  1. Click Add Criteria. Process Builder page for Set Out of State Travel Flag
  2. 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. 

Process Builder criteria page

3. Click Save

Add an Action

Next, we'll add an action to the process. 

  1. Click Add Action in the Immediate Actions section.
  2. 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. 

Select and Define Action page with out of state formula.

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. 

Process Builder page for Set Out of State Travel Flag

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.