1

We are submitting our application for Security review so we have to check FLS/CURD so we have a query like below.

Account ac  = [SELECT id, Name From Account limit 1];

so do we need to check isAccessible() for Id field here? I know we have to check for Name field but not sure do we really need to check same for Id field?

2

Let's do an interesting thing here:

Run below code in the developer console:

List<Account> acc = [Select name from Account];
System.debug(acc[0].id);

You will see that debug prints the Id of the account even when we didn't retrieve it.

Id field is generally included in the soql implicitly.

So i don't think it anyhow matters to check permission on ID field, It is not required and would only add the ambiguity.

Rather you should first check access on object itself then on it's fields.

0

As per my research ID field is not available for set FLS at the profile level. Then it not required to check isAccessible() prior to query. Further, if you have read access to object ID field is accessible by default.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.