2 Antworten
try like this,
Let us know if it helps.trigger appendChild on A(before insert)
{
Map<A,B> abmap=new Map<A,B>();
List<B> blist=new List<B>();
List<A> alist=new List<A>();
for(A aRecord : trigger.new)
{
abmap.put(aRecord,new B(Name='xyz'));
}
for(B b:abmap.values()){
blist.add(b);
}
insert blist;
for(A aRecord :abmap.keyset()){
aRecord.field=abmap.get(aRecord).Id;
}
}