- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2025 02:48 AM - edited 05-15-2025 02:49 AM
How can I make the 'Category' Field mandatory on a Security Incident Response Form - Only for New Records
Dear ServiceNow Community colleagues, please may I request your help/advice on how to achieve this.
I need to ensure the 'Category' field is mandatory on the Security Incident Response Form - but only for New Records.
How can I achieve this using a Client Script and what is the Client Script code to use, assuming this is an onLoad Client Script?
I am trying this myself, however it seems to be applying the mandatory field setting (to the Category field) even for existing Security Incident Response records.
I want to ensure the field is mandatory only when a new Security Incident Response record is raised.
Please see attached screenshot of the Security Incident Response form, showing the 'Category' field that I want to make mandatory - only for new Records.
Many thanks for any guidance/advice.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2025 03:06 AM
no scripting required.
You can achieve this using UI policy
UI Policy Condition: Created [IS EMPTY] (This condition will only satisfy for new record)
UI Policy Action: make field mandatory
New Record:
Existing Record:
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2025 02:53 AM - edited 05-15-2025 02:54 AM
Hi @WazzaJC
Create a Client Script:
Table: sn_si_incident (or your specific Security Incident table)
Type: onLoad
UI Type: All
function onLoad() {
if (g_form.isNewRecord()) {
g_form.setMandatory('category', true);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2025 03:00 AM - edited 05-15-2025 03:00 AM
Hi @WazzaJC ,
The solution suggested by @Arun_Manoj is good if you are only trying to make the category as mandatory from the client side expecting that the security incident can only be created by user directly from native UI.
Other ways you can also use:
1. UI Policy with "category" as mandatory.
2. Data policy with "category" as mandatory, this will restrict creation of security incident even if record gets created from API.
Please mark the answer helpful and correct if it resolves the issue. Happy scripting 🙂
-Shantanu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2025 03:37 AM
Thanks very much Arun, I appreciate your help with this guidance, much appreciated 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2025 03:01 AM
Hi @WazzaJC
Why not you try to make it mandatory when SIR in new state only.
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]
****************************************************************************************************************