Hi I want to Hide few fields in Incident form for certain groups in servicenow how can i achieve this thourght UI policy or ACL or Business rule.

siddharth26
Tera Guru

Hi all,

 

I want to Hide few fields in Incident form for certain groups accessing it in servicenow. how can i achieve this thorough UI policy or ACL or Business rule.

 

thanks

Siddharth

1 ACCEPTED SOLUTION

Glad that it worked.

Would you mind marking my response as correct & helpful if I am able to resolve your query?

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

27 REPLIES 27

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Siddharth,

There are couple of approaches based on how many fields you want to hide

You cannot check group membership in UI Policy condition:

1) you need to create individual field level READ ACLs on those fields and in advanced script section use this

If logged in user is not member then it hides the field

answer = !gs.getUser().isMemberOf('GROUP ABC'); // pass group name here

OR

2) Another approach would be using Display BR and onLoad Client Script if you have more number of fields

Display BR:

g_scratchpad.isMember = gs.getUser().isMemberOf('GROUP ABC'); // pass group name here

Client Script:

function onLoad(){

if(g_scratchpad.isMember.toString() == 'false'){

// hide your fields one by one

g_form.setVisible('field1', false); // your field name here

g_form.setVisible('field2', false); // your field name here

}

}

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi Ankur,

Thanks for the information , in the client script were to we mention the group name please 

Because i have tried this onload script ,can you please tell me where do i use group name.

 

Thanks

Siddharth 

Hi Sidharth,

Along with onLoad client script you need to write display business rule as well on that table.

There is no function in client side to check group membership.

So please create display business rule on the table and apply the code

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hello Ankur

How to include multiple groups those shouldn't be able to view a few set of form fields

Could you help me out on the approach?