You need to sign in to do that
Don't have an account?
Help with getting correct value from a List Object
Dear Gurus,
this is probably a no-brainer, but I am looking for help with the following:
I have an Apex class where I am trying to access values from a field that I have put in a List object. Then object populates as expected...However the below string format is returned using the method - uanVals.get(i). It is my understaning that the get method on the List object will return me the result in the proper index ....which it does.
The method uanVals.get(i) from a list object returns the proper records, however the formate below is giving me trouble.
"Utility_Account__c:{Utility_Account_Number__c=1008901001900249540108, Id=a0EQ0000001trzXMAQ}"
How can I get the call from the list object to only return me the string value I need. In this case '1008901001900249540108';
Thanks in advance
It seems that you have created the list of objects. This list contains objects as elements. So when you tried to access a element of list( that is an object), it returned an object. In your case if you want to access a particular field of that object then your syntax should be like given below,
(uanVals.get(i)). Utility_Account_Number__c
All Answers
It seems that you have created the list of objects. This list contains objects as elements. So when you tried to access a element of list( that is an object), it returned an object. In your case if you want to access a particular field of that object then your syntax should be like given below,
(uanVals.get(i)). Utility_Account_Number__c
Thanks Pradeep, your solution works!