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

update parent field based on child records



How can i concat mulitple line items to single string value?


For an example: Object B have 3 line items records like Test1, Test2, Test3

So set a single field (textarea) on the Object A with list of all line items records in Object B.


Thanks in advanced!



Yeah, you can do that.  How exactly you go about it depends a bit on where you are executing the apex, but the basic premise is:


Account acc=[select id, All_Contacts__c, (select Name from Contacts) from Account where id=:myAccId];

for (Contact cont : acc.Contacts)
  All_Contact__c+=cont.Name + ':';