making fields mandatory through UI policy/Data Policy vs System dictionary

sameer_paudel19
Kilo Contributor

Making fields mandatory through UI policy and Data Policy is frequently used but I have also seen when where you simply go to system dictionary and make fields mandatory by clicking on check box. What is the best practice of making field mandatory ?

2 REPLIES 2

amaradiswamy
Kilo Sage

Hi Sameer,



If you make the field at dictioanr level, then the field will be mandatory at all times.



But, if you want to make fields mandatory only if a condition matches then we have to write UI Policy. Data policy will enforce data mandatory evne we rae trying to create records through script, without filling in the required fields.



So, it will depends purely on requirement.



UI policy will not work on list view( as it will work only when user is interacting with the form).



Thanks and regards


Swamy


The SN Nerd
Giga Sage
Giga Sage

Mandatory Fields



Dictionary


  • Pros
    • Easiest way to configure a field to be mandatory
  • Cons
    • Applies to ALL tables
    • Not picked up by Field debugger
    • Harder to track and maintain over time


UI Policy


  • Pros
    • Can control on table/view level
  • Cons
    • Does not apply on list editing, visual task boards (older versions)


Data Policy


  • Pros
    • Cannot be bypassed via UI
  • Cons
    • Cannot control on view level
    • Can cause issues on in flight tickets


Rule of thumb / best practice - Start with UI policy


Convert to Data policy if data validation is needed server side or prevent list edit



ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022