Part of tracking our supplies inventory is tracking our supplies Requisitions (our staff’s requests for supplies). Each Requisition has Requisition Line Items (the supplies being requested) in a master-detail relationship.
A Requisition can be partially fulfilled, that is, some Requisition Line Items can be approved and some can be rejected. But if the entire request is fulfilled, wouldn’t it be nice if the user wasn’t forced to update the status each Requisition Line Item to “approved” in addition to updating the status of the overarching Requisition to “fulfilled”?
Wondering what to do to switch the script and do the opposite (update the status of the parent records when all the related records reach a certain status)? Stay tuned for Part 2!
Update the status of all records in a related list when a parent record’s status is updated using Process Builder. This works for objects that are related by master-detail relationships as well as lookup relationships.
Start by opening Process Builder (search for it in the Setup search bar) and defining a new process on the parent object (we’re using the Requisition object in this example).
For your first criteria node, create a helpful name for the node such as “Status Delivered?” and select “Conditions are met” for the Criteria for Executing Actions. Then define your conditions to check that your Status field has been changed to “Delivered”. This is done with two separate conditions: using the “Is changed” operated and then the “Equals” operator.
Next, define your “Immediate Actions” that will execute if the conditions you just specifies in the last step are TRUE. Click “+ Add Action” and choose “Update Records” for the Action Type.
After giving the Action a helpful and descriptive label (Action Name), click in the lookup field in order to specify the Record Type. In the pop-up window, select the radio button for “Select a record related to the [Parent Object]”.
Then find the related object’s API relationship field, which for our example is “Requisition_Line_Items__r”.
Now simply select the field you want to update on the related records and specify the desired value.
And you’re done! Activate your process and test it out! Now when the parent record (Requisition) is marked as “Distributed” all the related records (Requisition Line Items) will be updated to “Distributed” as well.
BONUS: We could also add other actions here as well. Say for example that we want a custom field, “Date Distributed”, to be updated when the status of the Requisition is changed to “Distributed”. Easy!
Just add another Update Records action and use the option “Select the [Parent Object] record that started your process” instead.
Then choose your custom date field from the list and select “Formula” for the “Type”. Use the formula “TODAY()” so that the date field is updated to the current date whenever a user updates the status of the record to “Distributed”.
Have you solved this problem in a different manner? How would you make this solution better? Share and comment below!
In Part 2 of this series where we’ll automatically update the status of the parent record to a certain value (e.g. Distributed or Fulfilled) when all records in a related list are updated to a certain value (e.g. Distributed). For this we’ll use Workflow Rules aided by Roll-up Summary Fields.