0

I am using schema.getGlobalDescribe() to retrieve Object names and labels and further using the Object name to retrieve its field name, after that I'm converting the field names into a string (comma separated) but when I use it in a Dynamic Query, it throws an exception because it contains some fields that are not queryable. Is there a way to avoid such fields?

1
  • 1
    can you please add what concrete exception are you facing? and code snipped with a query as well Commented Dec 19, 2023 at 8:41

1 Answer 1

0

You can try using the standard classes of Salesforce - DescribeFieldResult and DescribeSObjectResult

Schema.DescribeFieldResult f = Account.Industry.getDescribe();
system.debug(f.isAccessible());

This will tell you whether the field is Accessible to the current user or not.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .