Newer Version Available

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

Display a Department’s Records by Default

This scoping rule displays contact records associated with a particular department by default for a user who works on them. The rule dynamically matches the contact owner's department with the current user's department.
Available in: Lightning Experience in Performance and Unlimited Editions

Tooling API

1{
2    "FullName":"Department A contact scoping rule",
3    "Metadata": {
4         "active":true,
5         "description":"View contacts from Department A.",
6         "enforcementType":"Scoping",
7         "masterLabel":"SR for Department A",
8         "recordFilter":"Department=$User.Department",
9         "targetEntity":"Contact",
10         "userCriteria":"$User.UserRoleId = '00Exxxxxxxxxxxx'",
11         "version":1
12    }
13}

Metadata API

1<?xml version="1.0" encoding="UTF-8"?>
2<RestrictionRule xmlns="http://soap.sforce.com/2006/04/metadata">
3    <active>true</active>
4    <description>View tasks contacts from Department A.</description>
5    <enforcementType>Scoping</enforcementType>
6    <masterLabel>SR for Department A contacts</masterLabel>
7    <recordFilter>Department=$User.Department</recordFilter>
8    <targetEntity>Contact</targetEntity>
9    <userCriteria>$User.UserRoleId = '00Exxxxxxxxxxxx'</userCriteria>
10    <version>1</version>
11</RestrictionRule>