Use client script or dictionary to make a field mandatory?

Suggy
Giga Sage

I have a simple use case - on a NEW incident form, make the 'DESCRIPTION' field as mandatory so that user fills it and only then can submit the form. This is my only requirement (dont care about API's/integrations).

 

Also note - there is only 1 VIEW configured for incident form and description field is shown in this view.

 

Question - which is the preferred solution and why?

Use [onLoad client script/UI policy] OR [make it mandatory in Dictionary]

7 REPLIES 7

Runjay Patel
Giga Sage

Hi @Suggy ,

 

UI Policy would be the right choice for this requirement.

Why - As per ServiceNow best practice we should avoid writing code if configuration enough to achieve the requirement.

Client Script: We need to write code make filed mandatory.

At Dictionary Level: Not recommended, if in future if you require it mandatory on conditional basis then you will not able to do.

 

-------------------------------------------------------------------------

If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.


Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay

-------------------------------------------------------------------------

 

Pavithra0812
Tera Expert

The Description field in the Incident table is inherited from the Task (Parent) table. If you mark this field as mandatory in the dictionary, it will become mandatory for all child tables as well.

 

Pavithra0812_1-1734688982948.png

To make the field mandatory specifically for the Incident table (and not for all child tables), you can use a dictionary override. Follow these steps:

  1. Navigate to the Dictionary Override related list in the dictionary entry.
  2. Choose the table (Incident) where you want to apply the override.
  3. Check the Override mandatory option and set Mandatory to true.

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Suggy 

 

UI policy is best, as it is No Code / low code and will not increase the technical debt.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Anand Kumar P
Giga Patron
Giga Patron

Hi @Suggy ,

 

Preferred ui policy no scripting with customisation we can achieve.

1)Dictionary:Always take precedence over ui policy and client scripts.

Use for global and non-conditional properties like mandatory or read-only, which apply across all interfaces.

Cannot handle conditional logic, its properties override UI Policies and Client Scripts unless explicitly set.

 

2. UI Policies: Executes after client script.

Use for conditional behavior on forms (e.g., make a field mandatory or visible based on other field values).

Must explicitly override Dictionary properties (e.g., set Mandatory = false if hidden).

 

3. Client Scripts

Use for complex or advanced logic that cannot be achieved with UI Policies (e.g., custom validation or dynamic field calculations).

Requires scripting knowledge and can impact performance if not optimized.

 

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0778442

If my response helped, please mark it as the accepted solution and give a thumbs up👍.
Thanks,
Anand