Help with onsubmit catalog client script
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2023 06:40 PM - edited 12-11-2023 06:42 PM
I have a multiple-choice type variable "resource_group" with four choices (A, B, C, D)
The script below should run for three B, C, and D except A. However, the script below runs on all four, and a request is not submitted.
function onSubmit() {
/*** Pop this gem into your script! */
if (g_scratchpad.isFormValid) {
return true;
}
var actionName = g_form.getActionName();
var business = g_form.getReference('resource_group_to_be_updated', getValue);
return false;
function getValue(business) {
if (business.manager.toString() == '') {
alert('cannot submit');
location.reload(true);
return false;
}
g_scratchpad.isFormValid = true;
g_form.submit(actionName);
}
}
Thanks
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2023 08:08 PM
Hi @MR1 ,
Instead of GetReference method ,use GlideAjax with a script include and try the below logic for submission.
https://www.servicenow.com/community/developer-forum/using-return-false-in-glide-ajax/m-p/2539749/hi...
Thanks