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.

Hiding fields on Record producers

sbolton
Mega Expert

I am trying to hide the short_description field on a record producer.   I created a UI policy that when the incident is a P1 it hids all fields and alerts the uset to call.   The script is working for every field but the short_description field.   I figured there was another UI policy or client script that was interfearing with the onChange UI policy so i disabled all UI policys and client scripts and tested the script.   Again all other fields i am needing to hide in fact hids but the short description.   How can i figure out what is interfearing with the UI policy to hide the short_description.

 

 

 

function onCondition() {

 g_form.setDisplay('short_description',false);
 g_form.setDisplay('Communications',false);
 g_form.setDisplay('u_investigation_opened',false);
 g_form.setDisplay('u_investigation_closed',false);
 g_form.setDisplay('u_incident_description_how',false);
 g_form.setDisplay('u_witnesses',false);
 g_form.setDisplay('u_incident_type',false);

 g_form.setMandatory('Employee Involved', false);
 g_form.setMandatory('Employee Involved', false);
 g_form.setMandatory('short_description', false);
 g_form.setMandatory('u_employee_name', false);

 alert('Code 1 Incidents require a phone call);
}

6 REPLIES 6

randrews
Tera Guru

check your dictionary for short description did someone check mandatory there... if it isn't a client script or a UI policy that is the only other place i can think of... other than a view br.


Sahil Chugh1
ServiceNow Employee
ServiceNow Employee

This is very old post but I am posting this answer to help someone who may face this issue in present or future.

Function setDisplay: false works when field is not mandatory like it has pre-check for mandatory. Reversing the code lines like below, should resolve the issue:

First:

g_form.setMandatory('short_description', false);

Then :


g_form.setDisplay('short_description',false);