Hands on 6 - Defining additional conditions when updating records

When you update records using Process Builder, you can filter the records that you are updating using conditions. To add filter conditions to an update records action, there are two steps, as follows:

  1. Select the updated records meet all conditions option
  2. Set the conditions that you want to use to filter updated records

Now, we will create a process to fulfill the preceding business scenario and use custom permissions to bypass the process for the System Administrator and Supply Chain User profiles:

  1. To create a process, navigate to Setup (gear icon) | Setup | PLATFORM TOOLS | Process Automation | Process Builder, click on the New button, and enter the following details:
    • Name: Enter the name of the process - Update open opps - out of business accounts.
    • API Name: This will be auto-populated, based on the name.
    • Description: Write some meaningful text, so that other developers or administrators can easily understand why this process was created.
    • This process starts when: Configure the process to start when a record is created or edited. In this case, select A record changes.
  2. Once you are done, click on the Save button; it will redirect you to the process canvas, which allows you to create the process.
  3. After Define Process Properties, the next task is to select the object upon which you want to create a process and define the Evaluation Criteria. For this, click on the Add Object node. It will open an additional window on the right-hand side of the process canvas screen, where you will have to enter the following details:
    • Object: Start typing, and then select the Account object.
    • Start the process: For Start the process, select when a record is created or edited. This means that the process will fire whenever a record gets created or edited.
    • Recursion - Allow process to evaluate a record multiple times in a single transaction?: Select this checkbox only when you want the process to evaluate the same record up to five times in a single transaction. In this case, leave this box unchecked.

The evaluation criteria page will look like the following screenshot:

  1. Once you are done, click on the Save button.
    1. After defining the evaluation criteria, the next step is to add the Process Criteria. Once the process criteria are true, the process will execute the associated actions. To define the Process Criteria, click on the Add Criteria node. It will open an additional window on the right-hand side of the process canvas screen, where you will have to enter the following details:
      • Criteria Name: Enter a name for the criteria node - Only for out of business accounts.
      • Criteria for Executing Actions: Select the type of criteria that you want to define. You can select either Formula evaluates to true, or Conditions are met (a filter to define the process criteria), or No criteria-just execute the actions! In this case, select Formula evaluates to true.
      • Build Formula: Use this to define the formula, using functions and fields. Select System Variable. It will open a popup, from which you can select the custom permission that you have created:
    • Likewise, add an [Account].RakeshGupta__out_of_business__c field, as shown in the preceding screenshot.
    • Under Advanced, select Yes, to execute the actions only when the specified changes are made.

    The process criteria will look like the following screenshot:

    1. Once you are done, click on the Save button.
      1. Once you are done with the Process Criteria node, the next step is to add an Immediate Action, to update open opportunities to Closed Lost. For this, we will use the Update Records action, available in Process Builder. Click on Add Action, under IMMEDIATE ACTIONS; it will open an additional window on the right-hand side of the process canvas screen, where you will have to enter the following details:
        • Action Type: Select the type of action; in this case, select Update Records.
        • Action Name: Enter a name for this action. Enter Update open Opportunities as the action name.
        • Record Type: Select the record (or records) that you need to update. Click on the Record Type. It will open a window, where you will see two options: Select the Account record that started your process and Select a record related to the Account. These are radio buttons, and only one can be selected to update the child record. In this case, choose to Select a record related to the Account. Then, in the Type to filter list, look for the Opportunities child object.
        • Criteria for Updating Records: Optionally, you can specify conditions to filter the records that you are updating. Select Updated records meet all conditions to filter out the related opportunities records. Then, set the Stage field value from Does not equal to Closed Won.
        • Set new field values for the records you updateSelect the field whose value you want to set. In this case, set the Stage field to Closed Lost.

      The preceding steps will look like the following screenshot:

      1. Once you are done, click on the Save button.
      2. The final step is to activate the process. Click on the Activate button on the button bar. Finally, the process will appear, as shown in the following screenshot:

      From now on, if an account becomes out of business, then the process will update the related open opportunities stage to Closed Lost. This process will only work when an account is updated by a user whose profile does not equal the system administrator or supply chain user (because we have assigned a custom permission to these profiles). If you want to bypass a process for a single user, consider using a permission set instead of a profile.

      ..................Content has been hidden....................

      You can't read the all page of ebook, please click here login for view all page.
      Reset
      13.58.105.247