2

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?

2 Answers 2

1

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.

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

where AssigneeId is User.Id

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .