Access to form based on group.

sasi
Tera Contributor

i have 3 groups
Director
Junior and senior groups

if the user is part of director they should have access to see the cases which are assigned to director, junior and senior groups even though the director group members are part of junio /senior groups.

if (gs.hasRoleExactly('x_wms_directior') {
if (gs.getUser().isMemberOf(current.assignment_group.toString())) {
return true;
}
return false;

}

 

i tried this it's not working.. 

2 REPLIES 2

Amit Gujarathi
Giga Sage
Giga Sage

HI @sasi ,
I trust you are doing great.
Please find the below reference code

if (gs.hasRoleExactly('x_wms_director')) {
    // Check if the user is a member of the 'Director' group
    if (gs.getUser().isMemberOf('Director')) {
        return true;
    }

    // If not, check if the user is a member of 'Junior' or 'Senior' groups
    if (gs.getUser().isMemberOf('Junior') || gs.getUser().isMemberOf('Senior')) {
        return true;
    }
}

return false;

Was this answer helpful?


Please consider marking it correct or helpful.


Your feedback helps us improve!


Thank you!


Regards,


Amit Gujrathi



Hi Amith,

 

Thanks for the quick response,

here i have one  more condition director may not be a part of junior/senior group. in that way hasrole condition will not match right?