+ Start a Discussion

Trying to map in memory


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.

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?
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.