+ Start a Discussion
Rajkumar CV 12Rajkumar CV 12 

How to get value for a single field in List<SObject>?

Hello All,

I have a List<SObject> which has various fields inside it. I need to get the value of one field inside the list and store it as a string.
The size of the list is 1 is all the cases.

List<SObject> values = UpdateActionMap.get(keyIteration);
String busiType = (String) values. ....... ?

Can anyone help me how to achieve this?
 
Footprints on the MoonFootprints on the Moon
Try below line-
String busiType = String.valueOf( values[0] );

Let me know if it helps.
AnudeepAnudeep (Salesforce Developers) 
Hi Rajkumar, 

Try storing your result in a list<string>
List<string> lsstr= new List<string>();

for(Object a: values){
   lsstr.add(String.valueOf(a));
}
Anudeep