Skip to main content
hi everyone,

 

I have 2 custom objects obj1, obj2 and having lookup relationship from obj1 to obj2. And both objects have status has picklists(open/close). my requirement is if the status of records changes to close in obj1 then the corresponding  obj2 status must be updated with close.

 

Thanks.
5 Antworten
  1. 6. Sept. 2019, 04:46
    Hi sai, 

     

    When you have a lookup relationship from object1 to object2, your lookup field would be on object1 and it points to object2. If that understanding is correct you need to write a before update trigger on object1, when the status change to close write the below code

     

     Obj2ApiName varName=new Obj2ApiName(Id = Obj1. LookupFieldName) 

     

    varName. statusField = Obj1. statusField

     

    Update varName

     

     
0/9000