In the last article Getting Started with Process Builder – Part 1 I had discussed the way to auto create a child record. In this article, I am going to explain another concept, i.e. Auto update records and the concept of time-dependent actions in Process Builder. Let’s start with a business use case
Business Use case: – Steve Cartwright is working as System administrator in Universal Container. He receives a requirement to auto update Asset Description (with the sentence “Update the Serial Number “) field after 1 day of its creation, if Asset’s Serial Number is blank.
Solution of above business requirement
To solve the above business requirement, we will use Process Builder. Process builder allowed us to update the record from same object or records from child object or records from the parent object (In both the cases master-detail or look-up relationship). Whereas Workflow rule allows us to only update the record from the same object or parent object (In the case of master-detail relationship only). At the end of this article, I will show you how to track time-dependent actions and the hidden concept behind it. Follow the below instructions to create a Process for the above business requirement
1. Click on Name | Setup | App Setup | Create | Workflows & Approvals | Process Builder
2. To create a new process from scratch, click on the New Button available on Process Management page, A popup will open where you have to enter Name (Enter Update Asset description as name), API Name and Description as shown in the below screenshot
3. Once you click on the Save button, it will redirect you to Process canvas. Click on Object node to add object and set the evaluation criteria, Please refer to the following screenshot for more details
4. The next step is to define Process criteria. For this click on Add Criteria node, enter Criteria Name, Set filter conditions (Similar to Rule Criteria in WFR), as shown in the following screenshot
5. The next task is to set the time for scheduled action. For this click on Set Schedule available under Scheduled actions. Set time for scheduled actions as shown in the following screenshot
6. Now we have to add a Time-based action into the Process to update the Asset record. For this use Update Records action, Use Field Picker to select the field Description and Text Entry field to enter a comment or sentence. Click on the Asset object as shown in the following screenshot to select the object
Then select the Description field and enter the comment, Please refer to the following screenshot for more details
7. Finally the Process will look like the following screenshot, clicking on the Activate button.
Now onwards if you create an Asset record without Serial Number, It will schedule a time-based action to update the records as per your Process design.
It’s time to test this Process
To test this flow, create an Asset record as shown in the following screenshot
Flow created by Process builder and Time-dependent Queue for Process Builder
In the last article Getting Started with Process Builder – Part 1 I had discussed the way to see the Flow created by Process Builder for any particular Process. Follow the below instruction to open the Flow created by Process Builder and understand the concept of time-dependent action in Process Builder
1) Below is the Flow created by Process Builder see the Type i.e. Workflow different from normal (Flow or Autolaunched Flow). Now click on the Open link as shown in the following screenshot
2) It will open the Flow, which is generated by Process Builder for the Process we have created. There are two SObject Variables created by Process to pass old and New Id of record to Flow. If you check the flow very carefully, you can find there is a Wait Element used in the Flow as shown in the following screenshot
3) If you are working on a Flow and wants to wait for a few hours or days to complete a particular process, then you have to use Wait element. Wait Element is basically used to create time-dependent actions in the Flow, and this is used in Process builder for the same. It means Process Builder use Wait Element to create time-dependent actions, i.e. updates Asset record after 1 day of its creation in our case, please refer to the following screenshot for more details
4) As soon as you create a new Asset record and if it’s meet the Process entry criteria, it will schedule an action for the next day.
5) To check the Paused and Waiting Interviews in the Flow, click on Setup | App Setup | Create | Workflows & Approvals | Flows navigate to a section Paused and Waiting Interviews as shown in the following screenshot
The same concepts apply to Process Builder time-dependent actions because it’s nothing but wait element. Use Paused and Waiting Interviews to monitor Scheduled actions from Process Builder.
6) If you click on Name, it will open the detail page for you, as shown in the following screenshot
It also allows you to edit the page layout by clicking on Edit Layout link, available on the top right corner of the page.
7) To remove a record from scheduled action, click on the Del link, as shown in the following screenshot
Note: – This is my finding and only for learning purpose. Don’t delete any actions or Flows.