Mandatory Field on HR Case Creation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2024 03:41 AM
Hello, I have a requirement to make Opened For field as mandatory on HR Case Creation step. I can't find a place to do that. UI Policy is not working for this place. I can't find it anywhere on Case Configuration that is related to making fields mandatory. Would appreciate a support.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2024 04:00 AM
Sure, you can make the 'Opened For' field mandatory on HR Case Creation step by using a Client Script. Here are the steps:
1. Navigate to System Definition > Client Scripts in ServiceNow.
2. Click on New to create a new client script.
3. Fill in the fields:
- Name: Give a name to your client script.
- Table: Select 'HR Case' from the dropdown.
- Type: Select 'onLoad'.
- Active: Make sure it's checked.
- Script: Add the following script:
function onLoad() {
var openedForField = g_form.getControl('opened_for');
if (openedForField) {
openedForField.setAttribute('mandatory', true);
}
}
4. Click on Submit to save the client script.
This script will make the 'Opened For' field mandatory when the HR Case form is loaded. If the field is not filled, the form cannot be submitted.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2024 04:02 AM
Hi @artur3 ,
Go to Case Creation Configuration:
Then under Case creation you can see the field "left task fields":
Open the form design and make it mandatory
If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Best regards
Anders
If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.
Best regards
Anders
Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2024 04:02 AM
Hi,
I believe you might need to make the field mandatory at the dictonary level for Opened for. If you wish to add/remove field you can navigate to HR Administration >> HR Case Configuration. However, mandatory can only be at dictionary level for the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2024 04:04 AM
Hi @artur3
If you want to make in conditions the use UI policy or even without condition too. or another way is make the filed mandatory at table level itself as shown by @AndersBGS
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]
****************************************************************************************************************