+ Start a Discussion
mobile vistexmobile vistex 

how to push map data into a list

hi iam actually trying to prepare a table where i want to push map data into list ? what is the approach to move data of map to a list in apex
SathyaTrekbin TechSathyaTrekbin Tech
Hi Vistex,

See the below snippet for pushing map data into a list:
List<String> lstData = new List<String>();
//add all map values into the list 

Hopefully, this helps you!

Hi ,

Use Map values() method as below.
Map<Id,Account> mapAccounts = new Map<Id,Account>();

mapAccounts.values(); // This is basically a list now of type List<Account>

Suraj Tripathi 47Suraj Tripathi 47

"Try this code."
for this, you need to use the values() method.
Map ObjectName is mapObj.
So you need to write mapObj.values();
List<String> listObj=new List<String>();

If you find your Solution then mark this as the best answer. 

Thank you!

Suraj Tripathi