---
schema_version: "1"
id: 7b92da84779d299783fda47911c557a764b6d8540dfa330bf8911b5dbe70c1d6
title: Modify the Dataflow Based on Row-Level Security
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_addpredicate.md
canonical_url: https://help.salesforce.com/s/articleView?id=analytics.bi_security_rowlevel_example_rolehierarchy_addpredicate.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 5a979c02a397fb2d14da1303593e6a4c5a48924658ef72950a7da951224a408b
description: Now it’s time to modify the dataflow definition file to account for the predicate.
products:
  - CRM Analytics
  - Cross Cloud
release: "264"
---
# Modify the Dataflow Based on Row-Level Security

Now it’s time to modify the dataflow definition file to account for the predicate.

### Required Editions

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small edition"><colgroup><col></colgroup><tbody><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in Salesforce Classic and Lightning Experience.</td></tr><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available with CRM Analytics, which is available for an extra cost in <strong>Enterprise</strong>, <strong>Performance</strong>, and <strong>Unlimited</strong> Editions. Also available in <strong>Developer</strong> Edition.</td></tr></tbody></table>

In this scenario, you have to make changes to the dataflow based on the predicate.

- Add a column in the dataset that stores a comma-separated list of the role IDs of all parents for each opportunity owner. When you defined the predicate in the previous step, you temporarily referred to this column as “ParentRoleIDs.” To add the column, you redesign the dataflow as shown in the following diagram:
    
    ![The diagram shows how you load data from the Opportunity, User, and User Role objects into the OppRoles dataset.](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-analytics-bi-264-0-0-production-enus/ec791473-f5b4-4f64-a656-9104f455d966/bi/images/bi/bi_security_opproleswithparentroles_dataflow_design.png)
    
    The new dataflow design contains the following changes:
    
    - Extracts the role IDs from the UserRole object.
    - Uses the Flatten transformation to generate a column that stores a comma-separated list of the role IDs of all parents of each user. When you determined the predicate in the previous step, you temporarily referred to this column as “ParentRoleIDs.”
    - Link the new column to the OppRoles dataset.
- Add the predicate to the Register transformation that registers the OppRoles dataset.

You modify the dataflow as shown below.

```
{    
   "Extract_Opportunity": {        
      "action": "sfdcDigest",        
      "parameters": {            
         "object": "Opportunity",            
         "fields": [                
            { "name": "Id" },                
            { "name": "Name" },                
            { "name": "Amount" },                
            { "name": "StageName" },                
            { "name": "AccountId" },                
            { "name": "OwnerId" }            
         ]        
      }    
   },    
   "Extract_User": {          
      "action": "sfdcDigest",          
      "parameters": {              
         "object": "User",              
         "fields": [                  
            { "name": "Id" },                  
            { "name": "Username" },                  
            { "name": "LastName" },                  
            { "name": "FirstName" },                  
            { "name": "Name" },                  
            { "name": "CompanyName" },                  
            { "name": "Division" },                  
            { "name": "Department" },                  
            { "name": "Title" },                  
            { "name": "Alias" },                  
            { "name": "CommunityNickname" },                  
            { "name": "UserType" },                  
            { "name": "UserRoleId" }                  
         ]          
      }    
   },    
   "Extract_UserRole": {          
      "action": "sfdcDigest",          
      "parameters": {              
         "object": "UserRole",              
         "fields": [                  
            { "name": "Id" },                  
            { "name": "ParentRoleId" },                  
            { "name": "RollupDescription" },                  
            { "name": "OpportunityAccessForAccountOwner" },                  
            { "name": "CaseAccessForAccountOwner" },                  
            { "name": "ContactAccessForAccountOwner" },                  
            { "name": "ForecastUserId" },                  
            { "name": "MayForecastManagerShare" },                  
            { "name": "LastModifiedDate" },                  
            { "name": "LastModifiedById" },                  
            { "name": "SystemModstamp" },                  
            { "name": "DeveloperName" },                  
            { "name": "PortalAccountId" },                  
            { "name": "PortalType" },                  
            { "name": "PortalAccountOwnerId" }            
         ]        
      }    
   },    
   "Flatten_UserRole": {        
      "action": "flatten",        
      "parameters": {            
         "multi_field": "Roles",            
         "parent_field": "ParentRoleId",            
         "path_field": "RolePath",            
         "self_field": "Id",            
         "source": "Extract_UserRole"        
      }    
   },    
   "Augment_User_FlattenUserRole": {        
      "action": "augment",        
      "parameters": {            
         "left": "Extract_User",            
         "left_key": [                
            "UserRoleId"            
         ],            
         "relationship": "Role",            
         "right": "Flatten_UserRole",            
         "right_key": [                
            "Id"            
         ],            
         "right_select": [                
            "Roles",                
            "RolePath"            
         ]        
      }    
   },    
   "Augment_Opportunity_UserWithRoles": {        
      "action": "augment",        
      "parameters": {            
         "left": "Extract_Opportunity",            
         "left_key": [            
            "OwnerId"            
         ],             
         "right": "Augment_User_FlattenUserRole",            
         "relationship": "Owner",            
         "right_select": [                
            "Name",                
            "Role.Roles",                
            "Role.RolePath"            
         ],            
         "right_key": [                
            "Id"            
         ]        
      }    
   },         
   "Register": {        
      "action": "sfdcRegister",        
      "parameters": {            
         "alias": "OppRoles",            
         "name": "OppRoles",            
         "source": "Augment_Opportunity_UserWithRoles",            
         "rowLevelSecurityFilter": "'Owner.Role.Roles' == "$User.UserRoleId" || 'OwnerId' == "$User.Id""        
      }    
   }
}
```

![Note](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-analytics-bi-264-0-0-production-enus/ec791473-f5b4-4f64-a656-9104f455d966/images/icon_note.png)

Note In this example, the dataset has columns Owner.Role.Roles and OwnerId. A user can view the values of these columns for each record to which they have access.