Getting an error - Submit canceled due to a script error - please contact your system administrator
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-06-2023 09:29 AM
Hi all, I have a catalog item, where if the option "Add" is selected, the attachment field becomes mandatory and the user gets a pop-up to attach a document. This seems to be working fine on the Service Portal but not working on the backend. I put in a HI ticket but the engineer said this is a custom script and needs to be looked at internally. This is the script for the catalog item. function onSubmit(control, oldValue, newValue, isLoading) { if (isLoading || newValue == '') { return; } //Type appropriate comment here, and begin script below var countRequired = 1; if(window == null){ // portal var choice = g_form.getValue('identify_the_type_of_epic_payer_plan_change_being_requested'); if (choice == 'Add') if(this.document.getElementsByClassName('get-attachment').length != countRequired) { alert('You must add attachments before submitting this request.'); return false; } } else{ // native view var length = $j("li.attachment_list_items").find("span").length; if(length != countRequired){ alert('You must add attachments before submitting this request.'); return false; } } } Please find the screenshot below. Any help would be appreciated. Thanks, Mallika
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-06-2023 11:25 AM
What a mess. Do yourself a favor and use short Catalog Item variable names. You can use the newer variable type of Attachment then a simple onSubmit Catalog Client Script or UI Policy to make it mandatory in both platforms based on the value of the other variable, or use one of the methods detailed here: