Reputation: 1
I have to 2 object having master-detail relationship. I want to update a Status picklist field in Parent object if any update is happening on either of the object (Parent or child). What will be the best approach?
Upvotes: 0
Views: 2120
Reputation: 43
Hope this helps give you some idea of the various solutions available. I've ordered them by simplest workflow updates to more complex process builders and lastly apex triggers, which resonates the best practice of clicks over code when implementing solutions on salesforce.
You can use a number of strategies here, I'll outline them below from simplest to complex (overkill):
- one on the parent object when a record is edited,
then update the status picklist field on the record .
- and another on the child object when a record is edited,
then upon selecting `field to update` as option, you will
be given the parent object and child object as options to
filter fields on, select parent object to filter fields on
then select the status picklist field from parent object.
Create a process builder flow on child object and update parent
object along with either of the two:
- create a workflow on the parent object to update the status
picklist field when a record is edited only.
- or alternatively to the workflow on the parent object, create
a process builder flow on parent object and update parent object.
Equally you can go to the lengths of writing an apex trigger
upon the parent object `onupdate` trigger and verify if a valid
change was made(meaning the change made to parent was not a
change on the status picklist field), update the the status
picklist field too.
Upvotes: 1