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
RajiiiRajiii 

Dynamic SOQL query result

Hi,

   I would get the values from dynamic soql query. here in detail  

   XmlRD__c queryResult = Database.query('Select \''+field +'\' from XmlRD__c where id = \''+ recordid +'\'');
              
   String Text = String.valueof(queryResult.field);


   Here the red marking field values getting dynamically changing. i want to get the dynamic field value. but here throwing the issue. How can i get.            

Best Answer chosen by Admin (Salesforce Developers) 
hemantgarghemantgarg

Try following :-

String Text = (String)queryResult.get(field));