customer id attribute and need for user to see multiple subaccounts

jhalfon
Participant I

I have customer id attribute populated with embed user id, but I need for the same user to be able to run reports for any of the 5 subaccounts under the main customer id

example: customer x is associated with attribute 123456. my row level security accounts for this and only shows this customer data for 123456. However, this customer also needs to see the 4 subaccounts listed under 123456. How do I make it so a user can see the subaccounts, but only for specific customers, not the entire system. I reviewed the Sql always where using an OR operator with attributes, but is the only way to do this to add additional user attributes and use the OR operator?

0 1 135
1 REPLY 1

On top of my head:

  • Build a reference table that has parent_id | child_id (with parent_id = child_id when child_id or parent_id is null )?
  • Join that table on the Explore
  • Create a user attribute populated with the child_id
  • update your sql_always_where:
sql_always_where: {{ _user_attributes['parent_id'] }} = ${reference_view.parent_id}
 AND {{ _user_attributes['child_id'] }} = ${reference_view.child_id} ;;