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

How do I access the standard and custom both fields of a standard object with a standard controller?

I am working on standard objects in which I want to fetch all fields (standard and custom both) dynamically in a list.
For custom fields can fetch from the dynamic list but doesn't get custom field’s value.
for(SObject feedObject: sobjs){
     if(feedObject instanceOf Lead){
          Lead_Title = ((Lead)feedObject).Title; 
          Lead_Company = ((Lead)feedObject).Company;
          Lead_TestField= ((Lead)feedObject).TestField__C;    //  doesn’t  get the value of ” TestField “.
hi Indranial Deria 
i debug your code my code working wel,l i featch custom filed as well please check your sobjs var list ,that you query TestFiled__c feild from lead
my sample code is here...
List<lead> sobjs =  [select id, Title,company,SICCode__c from lead where id ='00Q2800000MhEmI' ] ; 

for(SObject feedObject: sobjs){
          system.debug(((Lead)feedObject).SICCode__c);   // custom field 

User-added image

debug log -:
User-added image
 Please mark it as solved if this helps you so that it will make for others as a proper solution ;)