Row-Level Security Example based on Record Ownership

Let’s look at an example where you create a dataset based on a CSV file and then implement row-level security based on record ownership. In this example, you will create a dataset that contains sales targets for account owners. To restrict access on each record in the dataset, you will create a security policy where each user can view only sales targets for accounts that they own. This process requires multiple steps that are described in the sections that follow.

Note
Note Although this example is about applying a predicate to a dataset created from a CSV file, this procedure can also be applied to a dataset that is created from Salesforce data.
  1. Determine Which Data to Include in the Dataset
    First, determine what data you want to include in the dataset. For this example, you will create a Targets dataset that contains all sales targets.
  2. Determine Row-Level Security for Dataset
    Now it’s time to think about row-level security. How will you restrict access to each record in this dataset?
  3. Add the Predicate to the Metadata File
    For a dataset created from a CSV file, you can specify the predicate in the metadata file associated with the CSV file or when you edit the dataset.
  4. Create the Dataset
    Now that you updated the metadata file with the predicate, you can create the dataset.
  5. Test Row-Level Security for the Dataset
    You must verify that the predicate is applied properly and that each user can see their own sales targets.