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
aravindaaaaaravindaaaa 

Getting default fields for an object

I'm using Salesforce's REST API to get contact and lead info. I have a SOSL query where I search for an email address in both Contact and Lead SObject. I instruct the query to return some fields like FirstName, MobilePhone, etc., Now, if my SF org does not have the MobilePhone field visibility to true, the query returns "Invalid Column MobilePhone". Is there a way where I can fetch the available fields for an object using REST API before firing my query.

 

My SOSL query is FIND {test@er.com} IN EMAIL FIELDS RETURNING Contact(Phone, Id, Department, Email, isDeleted, Name, MailingCity, Title ), Lead(Id, City, Company, Country, Name, MobilePhone, Phone, State, Status, Street, Title)