Help

0

Record Rule based on many2many tags

Avatar
Adithya

I wanted to restrict the partners (contacts) to a user based on partner tags (technical name of field is "category_id"). As the partner tag field is a many2many field, I'm not able to achieve the required output. An example of requirement is described below - 

Partner Tags - KA, TN, AP, NCR

Users - user 1, user 2, user 3, user 4

Requirement - A record rule which restricts a user to view only those contacts for which he has the respective tag access. For example - user 1 should be able to view only those contacts for which the tag is 'KA'.

I tried few record rules to achieve this requirement but wasn't able to do. Please help me out on this.



Avatar
Discard
1Answer
0
Best Answer

Hi Adithya,

You can Try adding a new field under users for allowed partner tags (say partner_tags) and create a rule for Contacts as mentioned below.

[('category_id','in',user.partner_tags)]

1Comment
Avatar
Discard
Avatar
Adithya
-

Hi Kumar, The suggestion that you gave worked fine. Thanks!!