2

Suppose I run the following code:

String field1 = 'BillingCity';
String field2 = 'BillingState';
Boolean access1 = Schema.Account.getSObjectType().getDescribe().fields.getMap().get(field1).getDescribe().isUpdateable();
Boolean access2 = Schema.Account.getSObjectType().getDescribe().fields.getMap().get(field2).getDescribe().isUpdateable();
System.assertEquals(access1, access2);

I ran the code as myself, and it succeeded. But my question is, will this always succeed, for any possible user? And will it continue to, even if I switch out isUpdateable for isAccessible? Or if I change field1 and field2, provided they're still parts of the same compound field?

In other words, if two fields are part of the same compound field, can I depend on them having the same access?

  • There is no SF documentation that states this explicitly for individual std fields that are part of compound field. But, there is nothing in SF documentation that states otherwise either. I would assume that SF follows the same pattern for these fields as it would for any other standard field. Also, I've never heard of any problem in this area either. – arut Aug 18 at 11:59
1

Yes, this is guaranteed to be true, simply because individual fields in a compound field do not have Field Level Security. Compound fields only have Field Level Security available at the compound level, so whatever access is available for the compound field, all individual components will also have that same level of access. It is unlikely that it would change in a future release, because it could break a lot of code and/or integrations that depend on checking if the compound field's security controls are set.

| improve this answer | |

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.