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
kathyanikathyani 

Trying to map in memory

Hi,

I have an two objects Object A and Object B.

I created a map between Object A and Object B so that the Id of Object A is assigned to ParentId of Object B.
Object B.ParentId= Object A.Id - this is the goal. Assignment should happen in Map itself even before insert happens.

Steps:
Created a Map which links both objects.
insert Object A;
insert Object B;


Id in Object A gets generated only after it is inserted in the db. When I do this ParentId value is still displayed as null. So basically it is not getting Object A' Id value.

Can somebody help me soon?
mikefmikef
run your code in the after trigger of object a.
You can't update object a, but you can create object b and use object a's Id.