Newer Version Available

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

Retrieve and Update Information

Use the GET, PATCH, and DELETE methods to retrieve, update, and delete restriction rules.

This feature is a Beta Service. Customer may opt to try such Beta Service in its sole discretion. Any use of the Beta Service is subject to the applicable Beta Services Terms provided at Agreements and Terms.

Note

Retrieve

To retrieve information about your restriction rule, use the GET method.

Example HTTP Method and URI:

GET /services/data/v52.0/tooling/query/?/services/data/v52.0/tooling/query/?q=SELECT+id,+targetEntity,+enforcementType,+recordFilter,+userCriteria+FROM+RestrictionRule

Update

To update the restriction rule, use the PATCH method.

We recommend that you don’t update the value of targetEntity after the restriction rule is created. Instead, delete the restriction rule and create a new one with the correct values.

Example HTTP Method and URI:

PATCH /services/data/v52.0/tooling/sobjects/RestrictionRule/0eYxxxxxxxxxxxx2AY

Replace 0eYxxxxxxxxxxxx2AY with the ID returned when creating the restriction rule.

Example Request Body:

All Metadata fields must be included, even if you aren’t updating them. Specify the FullName value only if you’re changing this field.

In this example, we deactivate the restriction rule by setting active to false.

1{
2    "Metadata": {
3        "active": false,
4        "description": "Sales team can see only task records with specified record type",
5        "enforcementType": "Restrict",
6        "masterLabel": "Sales Team Record Type",
7        "recordFilter": "recordTypeId = '011xxxxxxxxxxxx'",
8        "targetEntity": "Task",
9        "userCriteria": "$User.ProfileId = '00exxxxxxxxxxxx'",
10        "version": 1
11    }
12}

Delete

To delete a restriction rule, use the DELETE method.

Example HTTP Method and URI:

DELETE /services/data/v52.0/tooling/sobjects/RestrictionRule/0eYxxxxxxxxxxxx2AY

Replace 0eYxxxxxxxxxxxx2AY with the ID returned when creating the restriction rule.

If you include Salesforce org IDs in your userCriteria or recordCriteria fields, you must modify these IDs before deploying to the target org if different from the org where the restriction rules were retrieved.

Note