I'm trying to find out how to (programmatically) determine if a user has the required permissions to for certain actions.

Specifically, according to this page https://help.salesforce.com/s/articleView?id=sf.meta_modify_metadata_perm.htm&type=5 , Salesforce says that someone needs to "have the Customize Application permission to create, update, and delete metadata records".

So my question is, how can I obtain this information via an API call? I've been searching for some time now but have not been able to find any answers.

  • Is that user the running user?
    – Adrian Larson
    Nov 17, 2022 at 17:17
  • @AdrianLarson The user I'd like to get this info for will have just oauthed into Salesforce
    – jerfp
    Nov 17, 2022 at 17:41

1 Answer 1


A query like this can answer that question:

FROM PermissionSetAssignment 
WHERE AssigneeId = :UserInfo.getUserId() AND
  PermissionSet.PermissionsCustomizeApplication = true

If you get a value greater than zero, then the user has permission to customize the application either by Profile or Permission Set.

  • is there a way do do this with an http api call instead of a query?
    – jerfp
    Nov 17, 2022 at 17:59
  • @jerfp You can use a REST API call, it's still going to be a query, though.
    – sfdcfox
    Nov 17, 2022 at 18:10
  • would it ever be possible that a user doesn't have the permissions to make this query?
    – jerfp
    Nov 18, 2022 at 14:22

You must log in to answer this question.

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