Query specific field permission for all Profiles:
SELECT Profile.Name FROM PermissionSet WHERE IsOwnedByProfile = TRUE AND Id IN (SELECT ParentId FROM FieldPermissions WHERE FIELD ='Payment__c.Firm__c' AND SobjectType = 'Payment__c' AND PermissionsRead = TRUE AND PermissionsEdit = FALSE) ORDER BY Profile.Name
PermissionsRead --> View permission for the field.
PermissionsEdit --> Edit permission for the field.
The below approach also works but the profile name will be displayed as [Object Object] in Query Editor,
SELECT Parent.Profile.Name FROM FieldPermissions WHERE FIELD = 'Payment__c.Firm__c' AND Parent.IsOwnedByProfile = TRUE AND SobjectType ='Payment__c' AND PermissionsRead = TRUE AND PermissionsEdit = FALSE ORDER BY Profile.Name
Query specific object permission for all Profiles:
SELECT Profile.Name FROM PermissionSet WHERE IsOwnedByProfile = TRUE AND Id IN (SELECT ParentId FROM ObjectPermissions WHERE PermissionsRead = TRUE AND SObjectType = 'CustomObject__c') ORDER BY Profile.Name
You can check all object level permission in the query. Such as,
PermissionsRead
PermissionsCreate
PermissionsEdit
PermissionsDelete
PermissionsViewAllRecords
PermissionsModifyAllRecords
【参考】:
Field Permission | Object Permission | Query Which Profiles Have Read Access To Specific Object?
最后
以上就是激动树叶最近收集整理的关于在Salesforce中使用SOQL查找Profile相关权限的全部内容,更多相关在Salesforce中使用SOQL查找Profile相关权限内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复