Question:
How to check the field access by querying UserFieldAccess table?
Answer:
1. Obtain the DurableId first before using it in the Query.
Example query to obtain the DurableId of the Account.Name field:
SELECT Durableid FROM UserFieldAccess
WHERE FieldDefinition.EntityDefinition.QualifiedApiName='Account'
AND FieldDefinition.QualifiedApiName='Name'
AND User.Id='<userId for the user you want to check field access for>'
Please Note: DurableId is a unique identifier for the field. Retrieve this value before using it, as the value is not guaranteed to stay the same from one release to the next.
2. Use the unique DurableId returned above to query UserFieldAccess.
SELECT DurableId,EntityDefinitionId,FieldDefinitionId,Id,IsAccessible,IsCreatable,IsUpdatable,UserId FROM UserFieldAccess WHERE DurableId = '<DurableId returned in query 1>'
Related Documentation:
N/A