Lookup fields from one standard object to another don't return results using the API Name. "Id" suffix has to be removed.
Last updated 2022-02-10 ·Reference W-4395187 ·Reported By 1 users
Summary
When reflecting fields that are permissionable but are standard lookup fields from one standard object to another standard object, the "Field" name given in fieldpermissions leaves off "id" on the end.
Repro
1) Login your Org
2) Open Developer Console
3) Execute the following sample SOQLs:
SELECT Field,Id,ParentId,PermissionsEdit,PermissionsRead,SobjectType FROM FieldPermissions where Field = 'Case.ParentId' AND SobjectType = 'Case'
SELECT Field,Id,ParentId,PermissionsEdit,PermissionsRead,SobjectType FROM FieldPermissions where Field = 'Case.ContactId' AND SobjectType = 'Case'
SELECT Field,Id,ParentId,PermissionsEdit,PermissionsRead,SobjectType FROM FieldPermissions where Field = 'Contact.AccountId ' AND SobjectType = 'Contact'
SELECT Field,Id,ParentId,PermissionsEdit,PermissionsRead,SobjectType FROM FieldPermissions where Field = 'Asset.AccountId' AND SobjectType = 'Asset'
Actual Result:
=====================
- Data is not returned when using the API Name mentioned in our documentation for the Standard lookup fields.
Examples: Case.ParentId, Case.ContactId, Contact.AccountId.
Expected Result:
==============
- Data should be returned when using the API Name of the Standard lookup fields as explained in our documentation for FieldPermissions object:
https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_fieldpermissions.htm
Workaround
After removing the "Id" part at the end from "Field" column in the WHERE, the SOQLs return records:
Examples:
SELECT Field,Id,ParentId,PermissionsEdit,PermissionsRead,SobjectType FROM FieldPermissions where Field = 'Case.Parent' AND SobjectType = 'Case'
SELECT Field,Id,ParentId,PermissionsEdit,PermissionsRead,SobjectType FROM FieldPermissions where Field = 'Case.Contact' AND SobjectType = 'Case'
Reported By (1)
Is it Fixed?
Any unreleased services, features, statuses, or dates referenced in this or other public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make their purchase decisions based upon features that are currently available.