Sub topic 8
Granting access with permission sets
This chapter assumes you can navigate Setup, know what a permission set is, and have already generated at least one external object with Validate and Sync. The examples use the hypothetical Product__x object from earlier chapters.
Why external objects start locked
Validate and Sync creates external objects, but it does not give anyone access to them. Until you grant access, most users see nothing. Admins who can "View All Data" or "Modify All Data" are partly exempt. Everyone else needs explicit permissions.
External objects use the same permission model as custom objects, with a few differences:
- Access is controlled by object permissions and field permissions, as for any object.
- Sharing rules, role hierarchy, and record-level sharing do not apply. The external system owns the records, so Salesforce has no owner or sharing table for them.
- Access to the external system itself is a separate layer, handled by the named credential and the external data source.
The two layers of access
A user needs both layers to see rows.
- Salesforce permissions on the external object and its fields.
- Authentication to the external system. With a per-user named credential, each user must also authenticate. With a named principal, one shared identity is used for everyone.
Object permissions
External objects support a smaller set of object permissions than standard objects. In a permission set, open Object Settings, select the external object, and choose from these:
| Permission | What it allows |
|---|---|
| Read | View records fetched from the external system |
| Create | Create records, only if the data source is writable |
| Edit | Update records, only if the data source is writable |
| Delete | Delete records, only if the data source is writable |
Granting Create, Edit, or Delete does nothing useful if the external data source is read-only. The write will fail when Salesforce calls out. Keep these permissions off unless the source supports writes.
"View All" and "Modify All" are not meaningful here, because no record-level sharing exists to bypass.
Field permissions
Each field on an external object has its own Read and Edit checkbox. Grant Read to every field users should see. Pay attention to these:
- ExternalId and DisplayUrl are standard fields. Give users Read on them if you want links and lookups to work.
- Name Field. The field you chose as the name field is what appears in lookups and list views. If users cannot read it, records look blank.
- Custom fields ending in
__ceach need explicit field access.
Setting it up
- In Setup, open Permission Sets and create one, for example
Product Viewer. - Open Object Settings, select
Product__x, and click Edit. - Check Read under object permissions.
- Check Read on
ExternalId,DisplayUrl,Name__c, andPrice__c. - Save, then assign the permission set to users.
- If the named credential uses per-user authentication, also grant access to the external credential principal. Users then authenticate under Authentication Settings for External Systems in their personal settings.
You can also reach the external data source from the permission set. Under External Data Source Access, you enable the data sources a user may call. Without this, users get an authorization error even with object access.
Common errors
- Empty list view, no error. The user has object access but lacks Read on key fields, or the external system returned no rows for the identity used.
- "Insufficient privileges" on a record page. Object Read is missing.
- Callout authentication error. The user is missing external data source access or the principal assignment.
- Edit button works but save fails. Edit permission is granted, but the data source is not set to writable.
Exercise
A user has Read on Product__x and all its fields, but every query returns an authentication error. The named credential uses per-user authentication. What two things should you check?
Show answer
Check that the user's permission set includes access to the external data source and the external credential principal, and that the user has completed authentication under Authentication Settings for External Systems in their personal settings.
Exercise
Why can't you restrict which Product__x records a user sees with sharing rules?
Show answer
The records live in the external system, so Salesforce stores no owner or sharing data for them. Record-level restrictions must be enforced by the external system, for example through the identity used in the named credential.