deepthij
ServiceNow Employee
ServiceNow Employee

Issue: When saving a catalog task, form will not save and seeing below errors in the form -

Error in the console log: Uncaught ReferenceError: g_ui_scripts is not defined

onSubmit script error: ReferenceError: g_ui_scripts is not defined:

function() {

saveAllSelected([ gel(id) ],[ gel(ref) ],',', '\\','--None--');

}

find_real_file.png

ReasonIf a catalog item has "Email" or "URL" type variables then the related "Catalog tasks" cannot be updated if 'variable editor' is added to the form (which displays the "Email" or "URL" type variables). When saving or updating the form you will get the console error.

Steps to Reproduce: 

1. Go to any catalog item and an "Email" or "URL" type variable
2. Go to the workflow that is attached to the catalog item and add a "Catalog Task" activity
3. Make sure to add the variables created in step 1, in the "Add Variables" section on the "Catalog Task" workflow activity
4. Order the item
5. Open the catalog task and make sure that "Variable Editor" is added to the form
6. Try to save the form

The form will not be saved and we can see this error in the console:
Uncaught ReferenceError: g_ui_scripts is not defined

Resolution: There is a Know error article for the issue. Please find the KE article here - KB0728538

Fix is available in Madrid Patch 2 and going forward.

Workaround - Deactivate the validation script if using Email - deactivate "sc_email" and if using URL - then deactivate "sc_url" temporarily to work as expected. Activate them back to Madrid Patch 2 or higher. This is only valid if you don't use service portal.

Steps to deactivate - 

Under system definitions > validation scripts > looks for "sc_email" or "sc_url" under type and deactivate.