+ Start a Discussion
Shubham Sinha 43Shubham Sinha 43 

How to update related records.

Hello Everyone,
There is one standard object 'Case' which has one related object called 'Replacement__c'. When a case record is created we are creating four potential records for that case. So, now requirement is whenever someone change the status of one replacement record say 'Selected', other three reoords should automaticaly updated as'Not Selected'. 

I need help how I can do it.
Syed Insha Jawaid 2Syed Insha Jawaid 2
Hi Shubham

You can use flows/trigger for this requirement.
You will have to query all the replacement records associated to the Case record and then iterate through them to update the Status of the records except the one which is currently being set as Selected.

Shubham Sinha 43Shubham Sinha 43
Thank You Syed.
Do you have any sample code or trigger for this.