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

Retrieve Data from a field using string.

Hello All,

I have the Api name of a field in string format. How can i retrieve the data from that field using that string. For example, 
On Lead object i ahave a field called Points__c.
Now in apex code i have somthing like this. String field = 'Points__c';

From this how can i get the value of lead.Points__c?

Thanks in advance.
Best Answer chosen by Vishnu_SFDC

it is easy.  lead.get('Points__c');