Make a field not mandatory
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2023 05:59 AM
Hi Everyone,
I have a requirement to make fields mandatory on the ritm level but only mandatory for a group of users completing the form? Below are the details of the process
The variables are hidden on the catalog item.
If the manager determines additional information is needed then the variables are required by a yes/no ui policy
The problem is the manager doesn't need to complete the form, so I need to exclude her and others from seeing them as required.
I realize the best way to achieve this is probably with a UIPolicy but I'm struggling on how to exclude the manager/group from seeing the variables as required.
Below is the script I have so far but not sure if there is a better way to do this or if its possible?
function onSubmit() {
//Type appropriate comment here, and begin script below
g_form.setMandatory('field_name',false);
}
Thanks so much for any feedback you have!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2023 11:42 AM
Hey Gemma, you're missing the last ")". There should be 2 of them at the end before the bracket.
if(gs.getUser.isMemberOf('sys_id_of_group')){
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2023 01:35 PM
Thank you @cgedney good catch.
Unfortunately I am now receiving a gs error. I used the script in a catalog client script, that was correct, right?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2023 02:15 AM
Hello @Gemma4
Sorry for that :- I have an alternate solution.
Create a Display Business Rule :-
g_scratchpad.manager = gs.getUser().isMemberOf('sys_id_of_manager');
g_scratchpad.usergrp = gs.getUser().isMemberOf('sys_id_of_group');
Create a onLoad() Client Script :-
function onLoad() {
if(g_scratchpad.manager == false){
g_form.setMandatory('field_name',true);
}
if(g_scratchpad.manager == true){
g_form.setMandatory('field_name',false);
}
}
Plz Mark my Solution as Accept and Give me thumbs up, if you find it Helpful.
Regards,
Samaksh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2023 09:13 AM
The good news is using the br and client script made the variable required. However, it is making it required for everyone; regardless of group and it should only be required for the group members if the variable additional information is yes. Do you have any ideas if this is possible to achieve? I'm sorry if I didn't explain well initially.
thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2023 10:41 AM
Hi @Gemma4 ,
Since you need to check the "group" , "members" . This information is from server side, So you need to use 'gs' User object "(gs.getUser().isMemberOf(Group_Name)" .
1. write a function in client callable script include to check the group of user.
2. write an OnLoad client script and make Ajax call , based of response from server you can hide or show the respective fields.
@Samaksh Wani gs (glidesystem) don't work on client side.
Hope it helps and please mark helpful if it solves the issue.
Thanks,
Pooja Singh