How do you secure record visibility for external contractor technicians in Salesforce Field Service using sharing, permission sets and territories?
Answer
External contractors should see only the records they need, so security is built on least privilege.
Approach
- Set organization-wide defaults for Work Order, Service Appointment and Account to Private (or Controlled by Parent where it fits).
- Give contractors a restricted permission set with only the objects and fields they need.
- Group contractor resources by Service Territory or by contractor company.
- Share records with them through sharing rules, public groups or Apex managed sharing, based on territory or contractor account.
- Hide sensitive fields such as price, margin and other customers' data with field-level security.
apex
WorkOrderShare shareRecord = new WorkOrderShare(
ParentId = workOrderId,
UserOrGroupId = contractorUserId,
AccessLevel = 'Edit',
RowCause = 'Manual'
);
insert shareRecord;
Good practice
- Remove access when the job is completed or the contract ends.
- Audit access regularly.
- Consider capacity-based resources for subcontractors who manage their own technicians.
- Test by logging in as a contractor user.
ContractorsSharingSecurityField Level Security