Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Not displaying complete choice list

PatriciaA987250
Tera Expert

Hello,

I am having issue to display the complete choice list and it only happen to certain roles . I have attached screen shots of what I am having issues with. Anyone have any ideas?

 

Admin, its working fine as it display the complete list:

Admin-choice list.png

 

When I impersonate to someone with the role I'm testing out, i get incomplete list:

Other user-choice list.png

 

6 REPLIES 6

Service_RNow
Mega Sage

Hi @PatriciaA987250 

please try code logic

1.

function onLoad() {
	//who to display it for - admin
	var isAdmin = g_user.hasRole('admin');

	if (!isAdmin){
		g_form.removeOption('contact_type', 'integration');
	}
}

2.

function onLoad() {
   //Type appropriate comment here, and begin script below
   
  var userRole = g_user.hasRoleExactly('wm_security'); 
 
   alert(userRole);

  if(userRole == true){
    g_form.removeOption('category','electrical');
  }
 

}

 

 Please mark reply as Helpful/Correct, if applicable. Thanks!

Hi Ram,

Thank you for your feedback. Btw I've found the root cause.