Best Practices for UI Policies where multiple fields and applications are involved

carlh
Kilo Guru

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

1 ACCEPTED SOLUTION

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      


View solution in original post

10 REPLIES 10

If I have answered your question, please mark my response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.



If you are viewing this from the community inbox you will not see the correct answer button.   If so, please review How to Mark Answers Correct From Inbox View.



Thank you