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
Raksha NarayanRaksha Narayan 

concatenate 2 list values into single record in apex

List1<account>: ({Name=Acc1, type__c=Marketing,Agree__c=no},{Name=Acc2, type__c=Sales,Agree__c=yes})
List2<account>: ({Name=Acc1, Sla__c=new},{Name=Acc2, Sla__c=pending})
I need to compare list1's name == list2's name and then concatenate/merge two lists into 1 record.
List3<account>: ({Name=Acc1, type__c=Marketing,Agree__c=no,Sla__c=new},{Name=Acc2, type__c=Sales,Agree__c=yes,Sla__c=pending})
Please let me know if it is possible.
SUCHARITA MONDALSUCHARITA MONDAL

Hi Raksha,

You can do something as below:

 

List<Account> combinedAccList = new List<Account>();
combinedAccList.addAll(firstAccList);
combinedAccList.addAll(secondAccList);

 

Hope this helps,
Sucharita