Visibility of 'Confidential' field on Incident form

himanshu07
Tera Contributor

We have a field on Incident form "Confidential" and I have a requirement to control its visibility.

This field should be visible, if user CHANGES the Assignment group and he is a member of that group without saving the incident form

Please note, we already have one write and one read ACL which controls it's visibility but it works when the changes are saved.

I am thinking to write one  Onchange client script to complete this task, if this is the solution, please help me with the code.

 

Thanks in Advance ! 

6 REPLIES 6

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Himanshu,

yes onChange would be best way to handle this and you can deactivate the ACL if needed, since onChange can function for onLoad as well.

you can hide the field if condition not matching

Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur

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

Anurag Tripathi
Mega Patron
Mega Patron

i believe it should be doable via client scrips.

1 Onload Client scrip that always hides the confidential field regardless.

1 onchange client script (make sure that this does not run onload at all) this wil amek the field visible when needed.

 

 

In the above scenario the onchange will show the field when the form is not saved, and after save the form reloads and onlad hides the field.

-Anurag

Thanks Anurag, can you help me with the code for onChange client script, as I am bad in scripting 

I have no idea about the field names etc. I would encourage you to write the scripts yourself or use UI policies and if it doesn't work we can help you here to correct it. Would help you learn.

 

To start with

g_form.setDisplay('<FIELD NAME>', false); //hides the field, will go in onload

 

g_form.setDisplay('<FIELD NAME>', true); //shows the field, will go in onchange

-Anurag