Skip to content

Specify the Running User via Named Credentials

Doug Ayers edited this page Feb 3, 2019 · 3 revisions

Home > Pre-Requisites > Specify the Running User via Named Credentials


When any action is taken in Salesforce, the currently logged in user is known as the running user (also known as the context user), for those actions. The running user is whose name gets stamped as the "Last Modified By" when records are created or updated. Access to records and what the running user can do is determined by their assigned permissions (e.g. profile, permission sets) and any sharing rules.

Since Mass Action Scheduler is often used to schedule actions to happen automatically when no physical user is logged in to Salesforce to be the running user, then you have a couple options to specify who that running user is.

By default, the user who last activates a Mass Action Configuration record, or who manually runs it, is the running user. You also have the option to specify the running user by selecting a Named Credential on the Details step when configuring the record.

This page helps you create a Named Credential to specify the running user if you want that running user to be someone else other than the user who creates and activates the Mass Action Configuration record. Each Mass Action Configuration record can have a different Named Credential specified, or no Named Credential specified.

Table of Contents

  1. Create Connected App
  2. Create Auth. Provider
  3. Create Named Credential
  4. Assign Named Credential to Mass Action Configuration Record

Note that steps 1, 2, and 3 can be done automatically for you by navigating in app to the Mass Action Auth. Setup page.


1. Create Connected App


NOTICE: Steps 1, 2, and 3 can be done automatically for you by navigating in app to the Mass Action Auth. Setup page.


  • In Setup, type App Manager in the quick find
  • Click New Connected App button then fill out the form:
    • Connected App Name = Mass Action (or preferred name)
    • API Name = Mass_Action
    • Contact Email = <your email>
    • Enable OAuth Settings = <checked>
    • Callback URL = https://localhost.com (we will change this after creating an auth provider)
    • Selected OAuth Scopes = Full access and Perform requests on your behalf at any time
  • Click Save button then wait 10 minutes (otherwise may get errors about setup not ready when moving on to next steps)
  • On the detail page, note the Consumer Key and Consumer Secret values (we will use these in next steps)

screen shot

screen shot

2. Create Auth. Provider


NOTICE: Steps 1, 2, and 3 can be done automatically for you by navigating in app to the Mass Action Auth. Setup page.


  • In Setup, type Auth. Provider in the quick find
  • Click New button then fill out form:
    • Provider Type = Salesforce
    • Name = Mass Action (or preferred name)
    • URL Suffix = Mass_Action
    • Consumer Key = <enter value from connected app>
    • Consumer Secret = <enter value from connected app>
  • Click Save button
  • On the detail page, copy the Callback URL then go back to your connected app and replace https://localhost.com with this new Callback URL

screen shot

screen shot

3. Create Named Credential


NOTICE: Steps 1, 2, and 3 can be done automatically for you by navigating in app to the Mass Action Auth. Setup page.


  • In Setup, type Named Credential in the quick find
  • Click New Named Credential button then fill out form:
    • Label = Mass Action (or preferred name)
    • Name = Mass_Action
    • URL = https://<MyDomain>.my.salesforce.com/services/data/v44.0
      • In Lightning Experience your URL may look like https://<MyDomain>.lightning.force.com. Make note that the URL for the Named Credential does not use .lightning.force.com but rather .my.salesforce.com
      • For sandboxes the URL format to use must look like https://<MyDomain>.<instance>.my.salesforce.com/services/data/v44.0. To know your instance name (e.g. CS23 or CS8) navigate in Setup to Company Information and look for the field labeled Instance
      • Examples: https://my-production-domain.my.salesforce.com and https://my-sandbox-domain.cs23.my.salesforce.com
    • Identity Type = Named Principal
    • Authentication Protocol = OAuth 2.0
    • Authentication Provider = <choose the auth. provider you created earlier>
    • Scope = full refresh_token
    • Start Authentication Flow on Save = <checked>
    • Generate Authorization Header = <checked>
  • Click Save button, a login page will open
  • Follow on-screen instructions to login as the running user you want to assign to this Named Credential (I suggest an admin user)

screen shot

4. Assign Named Credential to Mass Action Configuration Record


  • Navigate to a Mass Action Configuration record and on the Details step, choose your Named Credential, and click Save.

The next time the job runs then the Named Credential will be used as the running user when the target actions perform their updates on the source records.

You can’t perform that action at this time.