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
KaityKaity 

Conversion of Set to List

How can I convert the Set od IDs to List of IDs. Because I am using 'oldmap' concept? 

 

-Kaity

Avidev9Avidev9

I guess you can easily do that

 

List<Id> idList = new List<Id>();
idList.addAll(trigger.oldMap.keySet());

 

Subhani PSubhani P

 

Hi ,

 

You can try the following way to convert from Set to List in Salesforce.

 

Ex:

set<string> sId = new set<string>();
sid.add('xxx');

List<string> lId = new list<string>();

for(string idVal: sid){
lId.add(idVal);
}

system.debug('....listVal...'+lid);

 

 

Thanks,

Subhani,

DBSync,

www.mydbsync.com

 

 

 

 

 

 

 

 

 

PatlatusPatlatus

Hi.

You can just use the following shorten form

    List<Id> idList = new List<Id>( trigger.oldMap.keySet() );