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.

How to Visible Field based on user role (LIKE : change _manager) on change request ?

ram_sn2018
Kilo Contributor

How to Visible Field based on user role (LIKE : change _manager) on change request ?

Scenario : When ever Change manger group members login  that time only one more extra  field (Like : Author side ) field visible. Please help me ....

 

Thanks,

Ram

1 ACCEPTED SOLUTION

It's really quite messy to use a UI policy here I would recommend an onLoad client script or an ACL.

 

However if you simply must have a UI policy then you can create one with a condition that is always true

like number is not empty

reverse if false is off

run scripts true

Execute is true script

function onCondition() {
var hasRole = g_user.hasRole('change_manager');
if (hasRole ==true) {
g_form.setVisible('u_ram', true);
} else{
g_form.setVisible('u_ram', false);
}
}

 

I have tried this in a dev instance and it's fine but you are really better off using an ACL or client script

View solution in original post

11 REPLIES 11

Wow ok....I gave the exact script to use and mentioned even in my post that it can be used in UI policy or Client Script.

Either way, glad you got a response, but for those looking at this thread. I covered UI policy and my script DOES work.

 

Thanks...


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

 

Yes ...its working  as we expected.. Thanks a lot...

 

Thanks,

Ram