Newer Version Available
Retrieve and Update Information
| Available in: Lightning Experience in Performance and Unlimited Editions |
Retrieve
To retrieve information about a scoping rule, use the GET method.
Example HTTP Method and URI:
GET /services/data/v64.0/tooling/query/?q=SELECT+id,+targetEntity,+enforcementType,+recordFilter,+userCriteria+FROM+RestrictionRule+WHERE+enforcementtype='Scoping'Update
To update a scoping rule, use the PATCH method.
We recommend that you don’t update the value of targetEntity after a scoping rule is created. Instead, delete the scoping rule and create another one with the correct values.
Example HTTP Method and URI:
PATCH /services/data/v64.0/tooling/sobjects/RestrictionRule/0eYxxxxxxxxxxxx2AYReplace 0eYxxxxxxxxxxxx2AY with the ID returned when the scoping rule was created.
Example Request Body:
Include all Metadata fields, even if you aren’t updating them. Specify the FullName value only if you’re changing this field.
This example deactivates the scoping rule by setting active to false.
1{
2 "Metadata": {
3 "active": false,
4 "description": "sales support associate sees only account records of specified advisor",
5 "enforcementType": "Scoping",
6 "masterLabel": "Advisor1 Record Set",
7 "recordFilter": "SOQL(id, SELECT Account__c FROM Client_Entitlement__c USING SCOPE EVERYTHING
8 WHERE Team_Entitlement__c IN (
9 SELECT Team_Entitlement__c
10 FROM User_Entitlement__c
11 USING SCOPE EVERYTHING
12 WHERE User__c = $User.id)
13 )",
14 "targetEntity": "Account",
15 "userCriteria": "$User.ProfileId = '00exxxxxxxxxxxx'",
16 "version": 1
17 }
18}Delete
To delete a scoping rule, use the DELETE method.
Example HTTP Method and URI:
DELETE /services/data/v64.0/tooling/sobjects/RestrictionRule/0eYxxxxxxxxxxxx2AYReplace 0eYxxxxxxxxxxxx2AY with the ID returned when creating the scoping rule.