remove mandatory field messages on change form
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
Hi Team
I have requirement that during change new state we have to make Risk assessment fields mandatory Risk Fields are customized field on change
We have written Ui policy to make the fields mandatory during new state.
Now everything is working as expected but now client want now to remove all mandatory Risk Assessment field messages on top of the form instead of that we need to have only one single message that "Risk Assessment is mandatory"
Is there any option that to remove oob functionality and add customized message
Please check and help me to proceed further on the requirement.
Thanks,
Pujitha
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
Hi @pujitha K ,
Instead of a UI policy, Can you write a client script(onSubmit) and check if these fields are empty if so throw a single error message "Risk Assessment is mandatory"
Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
Hi @Hemanth M1 ,
I have written client script(onSubmit) and tried but what it is happing is at the initial stage when we are just creating the change it will be in new state right at that time only these fields are mandatory and not allowing form to Submit.
My requirement is after initial change submission still change state will be in new right before going to another state it should not allow form submission and provide only one single message as "Risk assessment is mandatory.
Please help me out with the solution.
Thanks,
Pujitha
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
Hi @pujitha K ,
that's where you use "!g_form.isNewRecord()
you logic should be something like this
function onSubmit() {
//Type appropriate comment here, and begin script below
if (!g_form.isNewRecord() && g_form.getValue('state').toString() == '-5') {
if (!g_form.getValue("Risk_field")) { //check if empty, update with your risk field
alert("Risk info Mandatory");
return false; //abort the submission
}
}
}
Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
