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
SrtSrt 

I have two objects which are not related to each other, Let them be Object A and Object B.

Hi Devs,

I have two objects which are not related to each other, Let them be Object A and Object B.
When I insert an Object A successfully , I need to update a feild called 'Result' on Object B saying successful.

The code is bulkified and I am using a list to insert Object A, How can I update the records in B saying successful based on the Database.upsertResult(or any otherway) since both the objects are not related???

Thanks in Advance :)
SandhyaSandhya (Salesforce Developers) 
Hi,

Refer below link for similar discussion.

https://developer.salesforce.com/forums/?id=906F0000000B00qIAC
 
Best Regards,
Sandhya
Vinod ChoudharyVinod Choudhary
Hi Srihari,

There are two ways:

1. Use Process Builder
2. Use Trigger

Hope you can develop the Trigger or set a Process.

Thanks
Vinod 
Shamsi 110Shamsi 110

Do you want to update all records of object b to be updated when object A is Inserted?    

Trigger on Object A (After Insert)
{
      List<ObjectB> lstOfObjectB = [Select result from ObjectB];
     
      if(Trigger.IsInsert())
      {
           lstOfObjectB.result = 'successful';
          
      }
     update lstOfObjectB;
}


Mark my Answer, If it helps you.

Thanks,
Hasan Shamsi