Restricting group list in list collector based on logged in user

Vijay Baokar
Kilo Sage

Hi Folks,

 

I have a simple use case where i have 3 diff personas A,B &C and i have 10 groups in total. In a catalog we have list collector field where admin can see all 10 groups but how would we display or restrict group list based on logged in persona (A,B&C)

Suppose if current logged in user is A then he should only see 4 out of 10 groups where as for user B list collector should show 6 groups for C its again 5 groups.

Note: Not necessary that logged in user is a part of any group hence we are not checking group membership here or myGroup or is member of.

2 REPLIES 2

Shivalika
Mega Sage

Hello @Vijay Baokar 

 

Use advanced reference qualifier on list collector. 

 

Something like below 👇 

 

javascript:
var persona = gs.getUser().getValue('u_persona');
var groupList = [];

if (persona == 'A') {
groupList = ['group_sys_id_1', 'group_sys_id_2', 'group_sys_id_3', 'group_sys_id_4'];
} else if (persona == 'B') {
groupList = ['group_sys_id_5', 'group_sys_id_6', 'group_sys_id_7', 'group_sys_id_8', 'group_sys_id_9', 'group_sys_id_10'];
} else if (persona == 'C') {
groupList = ['group_sys_id_2', 'group_sys_id_4', 'group_sys_id_6', 'group_sys_id_8', 'group_sys_id_10'];
}

'sys_idIN' + groupList.join(',');

 

You can change them per your requirement. 

 

Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for the efforts and also move this questions from unsolved to solved bucket. 

 

Regards,

 

Shivalika 

 

My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194

 

My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeEISQCY

Shivalika
Mega Sage

Hello @Vijay Baokar 

 

Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for the efforts and also move this questions from unsolved to solved bucket. 

 

Regards,

 

Shivalika 

 

My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194

 

My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeEISQCY*