- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-13-2017 02:38 PM
Hi All,
I'm looking for guidance. I have added many fields to my incident form as required by the business to help report and troubleshoot application issues. I started adding business rules based on the application but have noticed strange behaviors when it comes to fields that are shared by applications and or business rules.
The question is, is it best to build UI Policies based on the application or should I make them for each field instead. Either way it's a ton of fields and UI policies.
I spoke to support on one issue. I had a field show up as mandatory but after I set a value, it doesn't appear on the form. It's part of another UI Policy and they say it's because of the "Reverse if False" being unchecked. I will have to start over and am not sure I understand that feature completely so while I'm at it I thought I'd ask for advice.
Anyone have tips?
Thanks
Carl
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-14-2017 05:39 AM
If it were my app and I had complex show/hide rules, I'd make it data-driven so when someone changes the rules, you don't have to refactor the code. Sort of a super-UI policy.
Create a lookup table that defines what fields you want to display under which conditions. Use a GlideAjax call in a client script to pass the current values, then returns a list (array, or comma separated values) of fields to show (or hide) and then run that through g_form.setDisplay().
I know that's a pretty broad picture of the solution, and may take some time to implement, but will save you maintenance time in the long run.
Docs: Client Scripts
Docs: GlideForm
Docs: GlideAjax
Client Script Best Practices - ServiceNow Wiki

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-14-2017 05:39 AM
If it were my app and I had complex show/hide rules, I'd make it data-driven so when someone changes the rules, you don't have to refactor the code. Sort of a super-UI policy.
Create a lookup table that defines what fields you want to display under which conditions. Use a GlideAjax call in a client script to pass the current values, then returns a list (array, or comma separated values) of fields to show (or hide) and then run that through g_form.setDisplay().
I know that's a pretty broad picture of the solution, and may take some time to implement, but will save you maintenance time in the long run.
Docs: Client Scripts
Docs: GlideForm
Docs: GlideAjax
Client Script Best Practices - ServiceNow Wiki
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-14-2017 06:37 AM
Thanks Chuck, I've got no way to make that happen on my own nor would I be able to coach my developers through it so I'm going to have to use the messy option.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2017 06:18 PM
Hi Chuck,
Let's say if I have a number of fields
> fieldA (Y/N) - field1
> fieldB (Y/N) - field2
> fieldC (Y/N) - field3
.....
and I create a lookup table to says display field1 if fieldA is 'Y', field2 if fieldB is 'Y' and so on,
Is there a way to create a single trigger for any time fieldA, B or C changed?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2017 07:45 PM
Hi Nam,
There's no single trigger that can watch for changes on multiple fields. You would require three client scripts and/or UI policies.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-06-2017 04:16 PM
Not what I hoped for but thanks Chuck