- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2023 02:37 AM - edited 10-31-2023 02:49 AM
Hi All,
I have created a variable named Attachment1 and the type as Attachment in record producer. I made it mandatory.
When someone submits the request via record producer, it has to display a message "Please fill the attachment along with screenshot ". I created a UI policy and in the run script I put a message like below.
But it is displaying common message "Some fields are incomplete: Attachment1 "
Please guide what changes are to be made. I want error message should appear below field
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2023 03:00 AM
Hi @Renu9
The mandatory error message will take precedence over custom messages & If mandatory fields not filled anyhow he/she will not able to submit the request.
Still if you want to display custom message then , make attachment variable non-mandatory and write onSubmit client script :
function onSubmit() {
//Type appropriate comment here, and begin script below
if (g_form.getValue('attachment_variable') == ''){
g_form.addErrorMessage('Please attach the file');
return false;
} else {
//g_form.addErrorMessage('Attached');
}
}
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2023 03:00 AM
Hi @Renu9
The mandatory error message will take precedence over custom messages & If mandatory fields not filled anyhow he/she will not able to submit the request.
Still if you want to display custom message then , make attachment variable non-mandatory and write onSubmit client script :
function onSubmit() {
//Type appropriate comment here, and begin script below
if (g_form.getValue('attachment_variable') == ''){
g_form.addErrorMessage('Please attach the file');
return false;
} else {
//g_form.addErrorMessage('Attached');
}
}
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates