Newer Version Available

This content describes an older version of this product. View Latest

Assign a Permission Set

After creating your scratch org and pushing the source, you must sometimes give your users access to your application, especially if your app contains custom objects.
  1. If needed, create the permission set in the scratch org.
    1. Open the scratch org in your browser.
      1sfdx force:org:open -u <scratch org username/alias>
    2. From Setup, enter Perm in the Quick Find box, then select Permission Sets.
    3. Click New.
    4. Enter a descriptive label for the permission set, then click Save.
    5. Under Apps, click Assigned Apps | Edit.
    6. Under Available Apps, select your app, then click Add to move it to Enabled Apps.
    7. Click Save.
  2. Pull the permission set from the scratch org to your project.
    1sfdx force:source:pull -u <scratch org username/alias>
  3. Assign the permission set to one or more users of the org that contains the app:
    1sfdx force:user:permset:assign --permsetname <permset_name> --targetusername <username/alias>

    The target username must have permission to assign a permission set. Use the --onbehalfof parameter to assign a permission set to non-administrator users.

    1sfdx force:user:permset:assign --permsetname <permset_name> --targetusername <admin-user> --onbehalfof <non-admin-user>