- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-19-2024 06:27 AM
Hello I have a catalog item where I am trying to hide a multiple choice value from all users who access the form unless they are part of a specific group. However the script I am trying to run isnt working.
function onLoad() {
var targetGroup = '09745cc9c3302200e7c7d44d81d3ae6f';
// Check if the current user is a member of the target group
if (!g_user.isMemberOf(targetGroup)) {
// Remove "op_3" option if the user is not a member of the group
g_form.removeOption('choice', 'op_3');
}
}
Does anyone see an issue with this approach? It seems like it should be a pretty simple script.
Thank you
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-19-2024 06:56 AM
Hello @dagarson ,
I doubt if isMemberOf is even a method of g_form object. isMemberOf is a method available in GlideUser object which works on the server side.
For your case I think you should try and create a client callable script include and do your validation there.
Please do leave a thumbs up if my response helped you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-19-2024 06:56 AM
Hello @dagarson ,
I doubt if isMemberOf is even a method of g_form object. isMemberOf is a method available in GlideUser object which works on the server side.
For your case I think you should try and create a client callable script include and do your validation there.
Please do leave a thumbs up if my response helped you