How to show/hide fields on parent/child incident

mkader
Kilo Guru

Hello,

I need to hide certain fields on a parent incident only and am having lots of trouble doing this. I also need to change choice list on certain fields based on incident type selection (this is also only on the parent incident). 

Thanks!

1 ACCEPTED SOLUTION

Noah Drew
ServiceNow Employee
ServiceNow Employee

Hi @mkader !

In regards to hiding the fields, I would use a UI Policy for simplicity.

To do so:

1. Go to System UI > UI Policies

2. Set the Table to "Incident [incident]"

3. Change the Conditions to [   Parent   |   is empty   ]

4. Save the record

5. In the UI Policy Actions related list, add the fields you want to hide and make sure to set the Visible dropdown to "false"

 

Now with the UI Policy in place, we can further expand into hiding the Choice Lists.

1. Go to the Script tab in the UI Policy we created

2. Check "Run Scripts"

3. In the Execute If True box change the code to suit your business needs. As an example, this code will remove the first choice of the Impact field:

 

function onCondition() {

g_form.removeOption('impact', '1');

}

 

Hope that helps!

If it did, please mark as Helpful and consider setting the reply as the Correct Answer to the question, thanks!

View solution in original post

13 REPLIES 13

Noah Drew
ServiceNow Employee
ServiceNow Employee

Hi @mkader !

No problem! Please try out the UI Policy as the condition described above will limit the change only to the Parent Incident. I have tried this OOB as well and it seems to be working as you intend.

Please remember to mark as Helpful and/or Correct if this works for you, thanks!

Hey @noah.drew@servicenow ,

I tried to create a new UI Policy to hide the fields, and it did not work.

1. Created a new UI Policy

2. Change the Conditions to [   Parent   |   is empty   ]

3. Clicked "Save" and then added "UI Policy Actions" to set visibility to false on certain fields.

I forgot to mention that I currently have 3 UI Policies that hide/display fields (all incident types). Could those UI Policies potentially be affecting the new one?

Noah Drew
ServiceNow Employee
ServiceNow Employee

It is entirely possible. Try deactivating them temporarily and see if it works.

Thanks @noah.drew@servicenow ,

I started from scratch, and it turned out there were other UI Policies interfering with what I was doing.

Thanks again!