Scenario
1. Create lookup field in contact object of contact, name as "Parent Contact". 2. Create picklist in contact name as Status with below values: a. Pending b. Running c. Completed 3. If someone change the status of contact then all parent contact should be updated with the same status. Example : Contact A Contact B Contact C Contact D Contact C is parent of Contact D, Contact B is parent of Contact C, Contact A is parent of Contact B Contact A (Status) = Running Contact B (Status) = Pending Contact C (Status) = Running And if we change the status of Contact D with "Completed" then all parent should be changed with "Completed" Status. public class StackEx { public Static void updaterec(Set<String> nstr, String str){ list<contact> ConListNew=new list<contact>(); list<contact> ContList =[select id,Parent_Contact__c,Status__c from contac...