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

rgm276
Mega Guru

We've done this by using the sys_id of the field in a Catalog UI policy script his way


function onCondition() {


document.getElementById('1a8af9943472adc0286558191d66517c').style.visibility="hidden";


}


you can also try to do these as catalog ui policy action


catCapture.JPG


since I see you are tyring to hide multiple fields, you can did this by grouping fields into a container, and then hiding the entire group by using that container start tag, i.e. using the code to hide the whole group\container, where the id is the word container + the container sys_id



function onCondition() {


document.getElementById('container_d9bab1587782adc0283358191d665133').style.visibility="hidden";


}



containerCapture.JPG


marcguy
ServiceNow Employee
ServiceNow Employee

is short description being set to mandatory? by default a ui policy will NOT hide a mandatory field as it will stop you from submitting the form if it did that.


Ravish Shetty
Tera Guru

I had a similar case during my days with the record producer. It turned out that another UI policy was making the field visible because the "Reverse if false" was checked and the condition of that UI policy was failing. This caused the field to be visible. It was supposed to hide the field if the conditions passed.