Catalog Client Script not making field mandatory

stephaniet
Kilo Expert

Hi everyone,

I have the following Catalog Client Script to make a field mandatory if a user has a specific role.

function onLoad(){

var user = g_user.hasRole('it_security');

if(user == true){

g_form.setMandatory('risk_comments_1',true);

g_form.setMandatory('sec_rating_1',true);

}

}

For some reason it is not making the field mandatory even though the user does have the role.   I have another script to make the same fields read only if the user does not have that role, and that one is working just fine.

Any help is appreciated!

1 ACCEPTED SOLUTION

ok the first thing i would do is disable all other client scripts and ui policies on the item... then see if it works right.. if so you have a conflict..enalble them one at a time and see which one breaks your client script and why.


View solution in original post

7 REPLIES 7

Shishir Srivast
Mega Sage

Can you please try



  1. function onLoad(){  
  2. if(g_user.hasRole('it_security')){  
  3. g_form.setMandatory('risk_comments_1', true);  
  4. g_form.setMandatory('sec_rating_1', true);  
  5. }

Unfortunately that did not make a difference


ok the first thing i would do is disable all other client scripts and ui policies on the item... then see if it works right.. if so you have a conflict..enalble them one at a time and see which one breaks your client script and why.


Thanks!   I found what was causing the issue!