Hide few fields for a specific role based on a condition

Renu9
Tera Contributor

Hi All,

I need to hide few fields on a form based on a condition and also for itil role. I am having 20+ fields on form and need to hide 3 fields.

Those 3 fields should not appear as per reporting purpose.

How can I proceed with this?

1 ACCEPTED SOLUTION

Hi,

you can use field level READ ACLs on those fields and hide those on list view

Regards
Ankur

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

View solution in original post

18 REPLIES 18

Hi Ankur,

If I use script to hide the fields, then those fields appear in the list view for reporting purpose right.

I donot want to display them in reports as they are confidential fields.

Kindly suggest

Hi,

you can use field level READ ACLs on those fields and hide those on list view

Regards
Ankur

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

@Renu 

Hope you are doing good.

Did my reply answer your question?

If my response helped please close the thread by marking appropriate response as correct so that it benefits future readers.

Regards
Ankur

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

Hi Ankur, Could you please guide how to hide them through list view after writing field level acls for those 3 fields separately. 1. Do I need to create read ACL on incident table or only for the fields (nearly 20) separately which I want to show them ? 2.How can those 3 fields to be hidden on list view?

Hi Ankur,

I have written an onLoad Client script based on itil role.

If logged in user is having itil role, then it has to hide Description field(As of now, I am only hiding description field)

function onLoad() {
var role_check = g_user.hasRoleExactly('itil');
if(role_check)
{
g_form.setDisplay('description', false);
}

else
{
g_form.setDisplay('description', true);
}
}

This script working fine to hide Description field on Incident form if user is itil

I want to also hide the description column in list view also as it contains confidential data . This has to be hidden only for itil user and for rest others it should be visible.

Could you please help me how to achieve this. I have created an ACL with operation as add_to_list on incident table field level(description) acl.

As I need to hide only for itil and to display it other roles, what role Do I need to keep in roles section. There is no advanced option for this type of operation. Kindly suggest