Problems with Form layout and Form sections

chazz1
Mega Contributor

Problems with Form layout and Form sections.

I am not sure if this is the right forum for this question/problem. It may even be a bug.

So, I have an incident form and this form has a form section called 'closure information' In this section i display a 'close code' dropdown list.

Here is where the problem is. First, i cannot get the 'close code' field to show up in the section unless i add the field to both the 'incident'(main) section AND the 'closure information' section. Is this by design? Second, if i create a UI Policy that makes the 'close code' field mandatory when the 'state' of the ticket is set to 'resolved'. when i do this (select 'resolved' from the sate dropdown) the close code field magically appears in the 'incident' section and is marked as mandatory (little red indicator) and nothing happens to the 'close code' field in the 'closure information' section. Also setting 'close cose' in the 'closure information' has no effect on the magically appeared field in the 'incident' section and i cannot save or update the ticket until the 'close code' field in the 'incident' section is set. Is this a bug?

how do i create a UI policy that makes the 'close code' field in the 'closure information' section mandatory and not magically make the 'close code' field appear and be mandatory in the 'incident' section?

1 REPLY 1

ninnesr
Kilo Contributor

Hi Chazz,

Wow, this is actually a bug. Having the two closure_code fields on the form, in the two separate sections, creates two DOM elements with the same ID (a big no no)

I assume that when a UI Policy tries to hide (or show) a field it only searches until it finds the first occurrence of the ID.

Here is a sample of the closure_code HTML







I assure you that what you are trying to achieve is completely routine, have a look in the demo instancefor the Show close code and notes if closed or resolvedUI Policy. You may be trying to do something that clashes with an OOB function.

In the meantime I'd log this as a bug with service-now, citing this forum post if they need more info.