You need to sign in to do that
Don't have an account?

How to convert or add a set(Ids) into a list<Sobject> in apex?
Hi All,
I have a scenario where i am adding some records to a set <Id> and that Set<Id> we have to add into a List using Addall but that is not possible.I need this list to be passed for Database.delete(List,False).Can i get soem ideas how to pass the set<Id> into a List<Sobject>
Example code:
Set<Id> parSet = new Set<Id>();
List<Account> DelAccLst= new List<Account>();
In this parSet i have some records and then after the forloop we need to add it to the list DelAccLst and this list i have to pass fro Deletion
DelAccLst.addAll(parSet );
Database.delete(DelAccLst,false);
How can i get this done please give me some ideas.
Thanks in advance,
I have a scenario where i am adding some records to a set <Id> and that Set<Id> we have to add into a List using Addall but that is not possible.I need this list to be passed for Database.delete(List,False).Can i get soem ideas how to pass the set<Id> into a List<Sobject>
Example code:
Set<Id> parSet = new Set<Id>();
List<Account> DelAccLst= new List<Account>();
In this parSet i have some records and then after the forloop we need to add it to the list DelAccLst and this list i have to pass fro Deletion
DelAccLst.addAll(parSet );
Database.delete(DelAccLst,false);
How can i get this done please give me some ideas.
Thanks in advance,
Try this:
Hope this helps you!
If my answer helps resolve your query, please mark it as the 'Best Answer' & upvote it to benefit others.
Thanks
Varaprasad
@For SFDC Support: varaprasad4sfdc@gmail.com
Blog: http://salesforceprasad.blogspot.com/
Salesforce latest interview questions :
https://www.youtube.com/channel/UCOcam_Hb4KjeBdYJlJWV_ZA?sub_confirmation=1
Set<Id> parSet = new Set<Id>();
List<Account> DelAccLst= new List<Account>();
In this parSet i have some records and then after the forloop we need to add it to the list DelAccLst and this list i have to pass fro Deletion --- If this list is only used for deletion purpose then You can declare it as 'List<Id> DelAccLst= new List<Id>();' and pass the list of id's to database.delete as in the below code.
DelAccLst.addAll(parSet );
Database.delete(DelAccLst,false);
Thanks.