Till now we had discussed Create a Record, Time-dependent action and Update records using the Process Builder. In this article, I am going to discuss another action available in the Process Builder i.e. Flows. Process builder allows us to auto launch a Flow. Let’s start with a business use case
Business Use case
Steve Cartwright is working as a System administrator at Universal Containers (UC). He has received a requirement from his manager to auto update the case owner with Assets owner if a case is raised for an Asset.
Solution for the above business requirement
You can solve the above business requirement through multiple ways (i.e. Apex trigger, Process Builder, etc.). We will use Flow and Process Builder to resolving the above business requirement. I want to say thanks to Kausar Shaikh for asking such a great question. This article will help you to understand, how to launch a Flow from Process builder. Follow the below instructions to create a Flow and Process for the above business requirement
1. Click on Name | Setup | App Setup | Create | Workflows & Approvals | Flows
2. Click on New Flow, it will open flow canvas for you, now create one Text variable VarT_AssetOwnerId to pass an Asset’s Owner ID, we will use into the flow, as shown in the following screenshot
3. Create one more Text variable VarT_CaseId to pass the Case Id, as shown in the following screenshot
4. The next step is to update the case owner ID with Asset’s Owner Id, for this we will use Record Update element. Drag-and-drop Record Update Element on the window and fill the details as shown in the following screenshot
5. Finally, your Flow will look like the following screenshot
6. Click on the Save button, save the Flow with the name Update Case Owner as shown in the following screenshot
7. Don’t forget to activate the Flow.
Launch a Flow from the Process Builder
Our next task is to create a Process on Case object to call a Flow. To create a Process on the Case object follow the below instructions
1. Click on Name | Setup | App Setup | Create | Workflows & Approvals | Process Builder and click on the New button, Enter Name, API Name and click on the Save button
2. Next step is to select the Object and Evaluation Criteria, for more detail, please take a look at the following screenshot
3. Now we have to add Process Criteria into this Process, so that Process will only execute whenever Case.AssetId is null, please take a look at the following screenshot
4. Now we have to add an Immediate action into the Process to Launch a Flow. For this use Flows action. Use Field Picker to select the field Description and Text Entry field to enter a comment or sentence. Click on the User object as shown in the following screenshot to select the object
5. Once you are done, activate the Process.
6. Add Asset field on the Case page layout and Grant field access to the users.
It’s time to test this Process
Now onwards if business users create a new case, Process builder will automatically update the case owner based on Asset’s owner if Asset is selected for that particular case.
1. Asset “Demo Record” record is owned by Demo User as shown in the following screenshot
2. Now I am going to create a new case for above-mentioned Asset from Rakesh Gupta user account, as shown in the following screenshot
3. Once you are doing with data entering, click on the Save button and check the Case owner, as shown in the following screenshot
Likewise, you can update the owner for any records dynamically.