Forum Discussion

Hussein_charif's avatar
1 year ago

tables relation issue

i have this db model :

for the customers table, the salesteam column is a calculated column taken from the salesteam table by using lookup(). i have made a rls rule with the userprincipalname() for the salesteam name. the problem is i have a page that uses the calculated column salesteam from the customers table, and it does not get filtered with the rls filter made on the accessteam table, and when i tried making a relation between the customers table and the salesteam table i got an error that the sales table has 2 paths to salesteam table, one from customers and one from salesperson. 

 

what can i do to solve the issue?

3 Replies

  • If removing the calculated column is not feasible, consider introducing a bridge table for SalesTeam to manage the RLS filtering:

    1. Create a bridge table that only holds SalesTeam values and connects Customer and SalesPerson.
    2. Establish relationships from both Customer and SalesPerson to the bridge table instead of directly linking Customer to SalesTeam.
    3. Apply your RLS on the bridge table to enforce filtering based on SalesTeam values.
    • Hussein_charif's avatar
      Hussein_charif
      Helper V

      i got an error ambiguous paths, because sales is connected to customer and customer is connected to the bridge table, and sales is also  connected to salesperson and salesperson is connected to the bridge table

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Hussein_charif ,

     

    If possible, I would recommend considering a modification to your data model by using Customers as a bridge table between SalesPerson and Sales, and applying RLS rules on AccessTeam.

     

     

    Best Reagrds,

    Bof