function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SFDC TechSFDC Tech 

Trigger to update field in a parent record based on child record

Hi , 
i am looking to write a trigger for the following scenario.
I am trying to update a field Lineitem_Status__c in the parent record(Contact object). based on the value of a field (Status__C) in the child record(which is a custom object).If the parent record(Contact) has more than one child record then the last updated value should be updated to the parent field.
Any assistance with code or any other work around for this is much appreciated!!

Thanks!!
 
William TranWilliam Tran
Have you explored doing this via a Workflow rule?  or even Process Builder?

No need to write triggers if you don't have to.

Thx
SFDC TechSFDC Tech
workflow doesn't seen to work on this case.

as its not possible to field update the parent field based on the child value