# Create a Wealth Management Scoping Rule Using the Tooling API

Create a scoping rule that shows a sales support associate who supports multiple financial advisors only the record set that corresponds to the financial advisor that the associate is working with. Use the RestrictionRule Tooling API object.

| Required Editions                                                                |
| -------------------------------------------------------------------------------- |
| Available in: Lightning Experience in **Performance** and **Unlimited** Editions |

| User Permissions Needed             |                                                                   |
| ----------------------------------- | ----------------------------------------------------------------- |
| To create and manage scoping rules: | Manage Sharing                                                    |
| To view scoping rules:              | View Setup & Configuration AND View Restriction and Scoping Rules |

:::note
You can use the RestrictionRule object to create and manage both restriction rules and scoping rules. For information on restriction rules, see the Restriction Rule Developer Guide.
:::

This example uses the SOQL operator in the recordFilter field to determine which accounts to display to the user based on the account, team, and user entitlements.

![Diagram illustrating the entitlement junction objects that connect the client (account) object to the user object, determining the user's access.](https://a.sfdcstatic.com/developer-website/sfdocs/security/media/scoping-rules-dev-guide/scoping_rules_wealth_mgmt_diagram.png)

1. Set a value for the `FullName` value (the full name of the associated metadata object in Metadata API).

2. Include all other required fields. For more information, see the reference topic [RestrictionRule](https://developer.salesforce.com/docs/atlas.en-us.restriction_rules.meta/restriction_rules/tooling_api_objects_restrictionrule.htm).

   In this example, we used these values.

   ```nolang
   {
       "FullName": "SalesSupportAssociateScopingRule",
       "Metadata": {
           "active": true,
           "description": "Sales support associate sees only account records of of Advisor1",
           "enforcementType": "Scoping",
           "masterLabel": "Advisor1 Record Set",
           "recordFilter": "SOQL(id, SELECT Account__c FROM Client_Entitlement__c USING SCOPE EVERYTHING
   	WHERE Team_Entitlement__c IN (
   		SELECT Team_Entitlement__c
   		FROM User_Entitlement__c
   			USING SCOPE EVERYTHING
   		WHERE User__c = $User.id)
   	)",
           "targetEntity": "Account",
           "userCriteria": "$User.ProfileId = '00exxxxxxxxxxxx'",
           "version": 1
       }
   }
   ```

3. Use a POST request to create the scoping rule.

   `POST /services/data/`68.0`/tooling/sobjects/RestrictionRule`

4. Copy your scoping rule definition into the request body.

5. Execute your request. Copy the ID returned for the scoping rule for later reference.
