My external service requires to write Campaign/Leads/Opportunities, so it requires the user to be a marketing user. Unfortunately, this can't be added to a permission set, so I need at least a way to check if the user it's a marketing user, in case it's not, I fail fast and report it to the user.

Any way to do it? I was thinking about Metadata API (which I have no experience with), but maybe I should look somewhere else.


The checkbox on the user's record is UserPermissionsMarketingUser. If they don't have this value set to true, you can fail early. You also need to check to see if they have permission on the Campaign object, found by querying the describe for Campaign. I'd probably suggest using the REST API, like so: /services/data/v33.0/sobjects/Campaign/, which will return a value similar to:

    "objectDescribe": {
        "activateable": false,
        "createable": true,
        "custom": false,
        "customSetting": false,
        "deletable": true,
        "deprecatedAndHidden": false,
        "feedEnabled": false,
        "keyPrefix": "701",
        "label": "Campaign",
        "labelPlural": "Campaigns",
        "layoutable": true,
        "mergeable": false,
        "name": "Campaign",
        "queryable": true,
        "replicateable": true,
        "retrieveable": true,
        "searchable": true,
        "triggerable": true,
        "undeletable": true,
        "updateable": true,
        "urls": {
            "sobject": "/services/data/v33.0/sobjects/Campaign",
            "approvalLayouts": "/services/data/v33.0/sobjects/Campaign/describe/approvalLayouts",
            "quickActions": "/services/data/v33.0/sobjects/Campaign/quickActions",
            "describe": "/services/data/v33.0/sobjects/Campaign/describe",
            "listviews": "/services/data/v33.0/sobjects/Campaign/listviews",
            "rowTemplate": "/services/data/v33.0/sobjects/Campaign/{ID}",
            "layouts": "/services/data/v33.0/sobjects/Campaign/describe/layouts",
            "compactLayouts": "/services/data/v33.0/sobjects/Campaign/describe/compactLayouts"
    "recentItems": []

Where "creatable" means the user has permission to create a new campaign, and "updateable" means the user has permission to update an existing campaign.

  • Thanks a lot!!! Are you sure creatable will be false when marketing user is not set? Because I added a permission set with "create campaign" permissions, but still couldn't create because wasn't a marketing user, which my logic says may end up with "creatable" true, but still not a marketing user. May 14 '15 at 15:03
  • They are two separate permissions. You must have both to use campaigns. If the object permissions are missing, you can't perform that action (e.g. create or update), and without marketing user permission, you can't use campaigns at all.
    – sfdcfox
    May 14 '15 at 15:41
  • Mh ok as I imagined. Unfortunately I suppose I need also retrievable/queryable permission to check that UserPermissionsMarketingUser on user record May 14 '15 at 17:37
  • Yes, unless you make a custom REST API function for that purpose.
    – sfdcfox
    May 14 '15 at 18:23

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.