---
schema_version: "1"
id: 6696879a44f2326ac4a75ce60d68638fe3c946bf7ae9cf6a0a4f0b838af608a4
title: Row-Level Security Example based on Role Hierarchy and Record Ownership
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/analytics/264-0-0/bi_security_rowlevel_example_rolehierarchy.md
canonical_url: https://help.salesforce.com/s/articleView?id=analytics.bi_security_rowlevel_example_rolehierarchy.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 53efe8105003d33f37779d57073168f4d07a4bedc5d601b7f8bfa837d00715f9
description: Let’s look at an example where you create a dataset based on Salesforce data and then implement row-level security based on the Salesforce role hierarchy and record ownership. In this example, you will create a dataset that contains all opportunities. To restrict access on each record in the dataset, you will create a security policy where each user can view only opportunities that they own or that are owned by their subordinates based on the Salesforce role hierarchy. This process requires multiple steps that are described in the sections that follow.
products:
  - CRM Analytics
  - Cross Cloud
release: "264"
---
# Row-Level Security Example based on Role Hierarchy and Record Ownership

Let’s look at an example where you create a dataset based on Salesforce data and then implement row-level security based on the Salesforce role hierarchy and record ownership. In this example, you will create a dataset that contains all opportunities. To restrict access on each record in the dataset, you will create a security policy where each user can view only opportunities that they own or that are owned by their subordinates based on the Salesforce role hierarchy. This process requires multiple steps that are described in the sections that follow.

1. **[Determine Which Data to Include in the Dataset](https://help.salesforce.com/s/articleView?id=analytics.bi_security_rowlevel_example_rolehierarchy_determinedata.htm&release=264.0.0&type=5)**  
    First, determine what data you want to include in the dataset. For this example, you will create the OppRoles dataset that contains all opportunities as well as user details about each opportunity owner, such as their full name, division, and title.
2. **[Design the Dataflow to Load the Data](https://help.salesforce.com/s/articleView?id=analytics.bi_security_rowlevel_example_rolehierarchy_designdataflow.htm&release=264.0.0&type=5)**  
    Now it’s time to figure out how the dataflow will extract the data and load it into a dataset. You start by creating this high-level design for the dataflow.
3. **[Determine Row-Level Security for the Dataset](https://help.salesforce.com/s/articleView?id=analytics.bi_security_rowlevel_example_rolehierarchy_determinerls.htm&release=264.0.0&type=5)**  
    Now it’s time to think about row-level security. How will you restrict access to each record in this dataset?
4. **[Modify the Dataflow Based on Row-Level Security](https://help.salesforce.com/s/articleView?id=analytics.bi_security_rowlevel_example_rolehierarchy_addpredicate.htm&release=264.0.0&type=5)**  
    Now it’s time to modify the dataflow definition file to account for the predicate.
5. **[Create the Dataset](https://help.salesforce.com/s/articleView?id=analytics.bi_security_rowlevel_example_rolehierarchy_createdataset.htm&release=264.0.0&type=5)**  
    Now that you have the final dataflow definition file, you can create the dataset.
6. **[Test Row-Level Security for the Dataset](https://help.salesforce.com/s/articleView?id=analytics.bi_security_rowlevel_example_rolehierarchy_testpredicate.htm&release=264.0.0&type=5)**  
    You must verify that the predicate is applied properly and that each user can see the appropriate opportunities.

#### See Also

- [flatten Transformation Parameters](https://help.salesforce.com/s/articleView?id=analytics.bi_integrate_flatten_transformation_operation.htm&release=264.0.0&type=5 "When you define a flatten transformation, you set the action attribute to flatten Transformation and specify the parameters.")