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
MrTheTylerMrTheTyler 

Available fields in a retrieved sobject

it possible to programmatically know what fields are available for a given instance of an sobject? Let's say I have a function that takes in a contact sobject that is queried from the database, could it know if let's say the firstname field is available for the particular instance of the sobject and if it is print it out and if not, don't?

 

 

string printFirstname(contact C){
  if (c.firstname.isavailable) system.debug(c.firstname);
}

 

 

Thanks!

 

Tyler