How to Update Parent Record From Child Object using Salesforce Flow

In Salesforce, we need to update records and fields according to the evolving and changing business requirements. We can automate this process using Salesforce Flow.

In this Salesforce tutorial, we will learn how to update parent record from child object using Salesforce Flow with real-time scenarios and step-by-step explanations.

Let’s consider a scenario to understand better. Whenever a New Case is created, we need to display the newly created case number in the Account object to show the latest case number.

Pre-requisite: We need a custom field to display the Case Number on the Account object; here, I have created a text field on Account with the Latest Case Number_c label.

To display the newly created case number on an Account object and update that when creating a new case, we need to create a Record-Trigger Flow to update it automatically when a New Case is created.

You can read the whole article: How to Update Related Records using Salesforce Flow.

How to Update Parent Record From Child Object Using Salesforce Flow

Using the above scenario and the following steps, we can update the parent record from the child object using Salesforce Flow.

Create Record-Trigger Flow:

1. Log in to Salesforce Org. -> Click on the Setup -> Home Tab -> In Quick Find Box, Search for Flows. You will see an option under Process Automation -> Click on Flows.

Then, click on the New Flow button to create a new flow.

See also  How to Use Salesforce Flow in List View

2. Here, when a new case is created, the account object should display the newly created case number. For that, create a flow with a Record Trigger Flow.

3. In our scenario, the flow should trigger when a new case is created. That’s why I have selected the Case in the Object field. In Configure Trigger, I have selected A Record is Created because when we create a new case the record, the flow should trigger.

Update Parent Record from Child Object Using Salesforce Flow

4. Then, we have to Set Entry Conditions, and in the Condition Requirement option, we have to select All Conditions Are Met(AND) because the following condition should meet the criteria.

Here, the flow has to trigger only when the AccountID(Case Object) is not Null.

We are going to update the Parent Object(Account) when the Child(Case) is created, so we have to select Optimize the Flow for Action and Related Records.

Update Parent Record from Child Object in Salesforce Flow

5. Now that we have the Object and Condition when the flow should be triggered, we need to update the Account object field when the criteria match. For that, add the Update Records element, enter the Label, and the API Name will populate automatically.

Select the Specify conditions to identify records and set fields individually to find records to update their values.

How to Update Parent Record from Child Object in Salesforce Flow

6. Then select the Account object in the Object field because we need to update Account records. Then, assign Case records to the Account records. For that, we need to apply the following conditions.

  • In the Field, we need to select Account ID, which we are updating.
  • In the value field, we need to assign this child record to the parent record. For that, we have the $Record global variable, from which we can get all Case records. We can then assign the Case Account ID to the parent Account ID.
See also  Automatically Add Users to Public Group Using Salesforce Flow

7. Then, set the Case record value to the Account Field; as per our scenario, we need to assign the Case Number value to the Latest Case Number Field.

Update Parent Record from Child Object in Salesforce Flows

8. After setting up all labels and conditions, click the Save button to save the flow. For that, we need to enter the Flow Label. The API Name will automatically populate as we click the text box. The Description is optional; we can introduce our flow Shortly.

9. After Saving the flow, click on the Debug button. Then click on the Activate button; always remember to debug the flow before activating it. It’s good practice to use flow.

How to Update Parent Record from Child Object Using Salesforce Flow

10. After Activating the flow, let’s check how it is working; for that, go to the Case object and create a new case. Here, I have created a new case with the account name Edge Communications and Saved the record.

Now check whether this same Case Number of the newly created case is displayed in the parent object.

How to Update Parent Record from Child Object Using Salesforce Flows

11. Here, you can see the newly created Case Number displayed in the Latest Case Number field of the parent object(Account) of the child object(Case).

Update Parent Record from Child Object Using Flow in Salesforce

This is how we can update parent records from child objects using Salesforce Flow.

Conclusion

I hope you have gotten an idea about record trigger flow in Salesforce and using Update Element in Flow. In that, we have seen how to update parent records from child objects using Salesforce Flow with real-time scenarios and step-by-step explanations.

You may like to read: