Given User.Id, how do I check with SOAP if this user has permission to create Contact or Lead?

Update: So far I've discovered only this solution:

SELECT ProfileId FROM User WHERE Id='0056g000002TnrpAAC'

SELECT Id FROM PermissionSet WHERE ProfileId='00e6g000000mn74AAA' // This we will use as ParentId in next query

SELECT PermissionsCreate FROM ObjectPermissions WHERE ParentId = '0PS6g000004cEH7GAM' AND SobjectType='Lead'

Is it possible to do it with one or two queries?


You can call the createable property of DescribeGlobalSObjectResult to verify whether the current user has read, create, or update access to an sObject, respectively. From the docs

DescribeGlobalSObjectResult represents the properties for one of the objects available for your org.

| improve this answer | |
  • 1
    I think the question is about getting CRUD for specific user id (not only running) and by using SOAP API, not Apex. – Oleksandr Berehovskyi Mar 25 at 20:48
  • 1
    Thanks @OleksandrBerehovskyi, updated answer. – Mahmood Mar 25 at 21:26
SELECT PermissionsRead, PermissionsCreate
FROM ObjectPermissions
WHERE ParentId in (SELECT PermissionSetId FROM PermissionSetAssignment WHERE
AssigneeId ='0056g000002TnrpAAC') AND SobjectType='Lead'

where AssigneeId is User.Id

| 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.