- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2023 07:39 AM
Hello,
I have a requirement to restrict the "overtime" time worked and time card category from users with the wm_agent role. I created a client script but it is not working. I think that is the way to go but scripting is a challenge for me. What am I doing wrong?
function onLoad() {
//Type appropriate comment here, and begin script below
if (g_user.hasRole('wm_agent'))
g_form.removeOption('category', 'overtime');
else if (g_user.hasRole('wm_qualifier'))
return;
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2023 08:15 AM
Yes, the backend name is "category". I added the alert and not seeing the alert come through.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2023 08:11 AM
Hi looks ok, however could you please check what is the backend value of overtime ? is it the same what you have used or something else ?
Also try using alert which shows if it is even reaching your if block.
alert(g_user.hasRole('wm_agent'));
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2023 08:15 AM
Yes, the backend name is "category". I added the alert and not seeing the alert come through.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2023 08:19 AM
I did get an alert box with "true".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2023 08:25 AM
I found the issue. Thank you for your help.