All Record Producers hang when submitting form

mcconnellsj
Kilo Sage

Hi we just upgraded to Madrid and have a serious problem with the service catalog.

It seems that all record producers hang after submitting the form.

The same error appears in the log each time.  The script in question is the Scripted REST Resource "Submit a Record Producer".  We have not changed this script.

**** HOWEVER IT IS INTERMITTENT ****

If record producer DOES succeed, no text fields are mapped to the record - only reference / choice field are mapped.

To confirm, it makes no difference which record producer is attempted.

VERY weird - please help!

JavaScript evaluation error on:
(function process(/*RESTAPIRequest*/ request, /*RESTAPIResponse*/ response) {

var recordProducerId = request.pathParams.sys_id;
var request_body = request.body.nextEntry();
var noValidation = (request_body.sysparm_no_validation == 'true');

var catalogUtil = new RestCatalogUtil();
var isMobile = false;


if (request.queryParams.sysparm_view) {
var viewType = '' + request.queryParams.sysparm_view;
viewType = viewType.toLowerCase();
if(viewType == 'mobile')
isMobile = true;
}

if(!catalogUtil.isValidItem(recordProducerId, 'sc_cat_item_producer'))
throw new sn_ws_err.NotFoundError('Record Producer does not exists');

var catalogItem = new sn_sc.CatItem(recordProducerId);

if(!catalogItem.canView(isMobile))
throw new sn_ws_err.BadRequestError("Security Constraints prevent access to the Item");

for (var key in request_body.variables)
if (request_body.variables.hasOwnProperty(key) && request_body.variables[key] && typeof(request_body.variables[key]) !== 'string')
request_body.variables[key] = request_body.variables[key].toString();

var variables = request_body.variables || {};

if (!noValidation) {
//Mandatory Variables Check
if(!catalogUtil.checkMandatoryVariables(recordProducerId, variables))
throw new sn_ws_err.BadRequestError('Mandatory variables are not filled');
}
var messages = catalogUtil.validateVariableRegex(recordProducerId, variables);
if(messages && messages.length > 0) {
var errorMsg = messages.join();
throw new sn_ws_err.BadRequestError(errorMsg);
}

request_body.sysparm_id = recordProducerId;
request_body.sysparm_action = 'execute_producer';
if (!request_body.sysparm_item_guid)
request_body.sysparm_item_guid = gs.generateGUID('');

return catalogItem.submitProducer(request_body);


})(request, response);
: org.mozilla.javascript.JavaScriptException: [object BadRequestError] (sys_ws_operation.4b9f0a8967101200d22b794717415a30.operation_script; line 35): org.mozilla.javascript.gen.sys_ws_operation_4b9f0a8967101200d22b794717415a30_operation_script_6334._c_process_1(sys_ws_operation.4b9f0a8967101200d22b794717415a30.operation_script:35)
org.mozilla.javascript.gen.sys_ws_operation_4b9f0a8967101200d22b794717415a30_operation_script_6334.call(sys_ws_operation.4b9f0a8967101200d22b794717415a30.operation_script)
org.mozilla.javascript.ScriptRuntime.doCall2(ScriptRuntime.java:2651)
org.mozilla.javascript.ScriptRuntime.doCall(ScriptRuntime.java:2590)
org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:42)
org.mozilla.javascript.gen.sys_ws_operation_4b9f0a8967101200d22b794717415a30_operation_script_6334._c_script_0(sys_ws_operation.4b9f0a8967101200d22b794717415a30.operation_script:1)
org.mozilla.javascript.gen.sys_ws_operation_4b9f0a8967101200d22b794717415a30_operation_script_6334.call(sys_ws_operation.4b9f0a8967101200d22b794717415a30.operation_script)
org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:563)
org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3429)
org.mozilla.javascript.gen.sys_ws_operation_4b9f0a8967101200d22b794717415a30_operation_script_6334.call(sys_ws_operation.4b9f0a8967101200d22b794717415a30.operation_script)
org.mozilla.javascript.gen.sys_ws_operation_4b9f0a8967101200d22b794717415a30_operation_script_6334.exec(sys_ws_operation.4b9f0a8967101200d22b794717415a30.operation_script)
com.glide.script.ScriptEvaluator.execute(ScriptEvaluator.java:279)
com.glide.script.ScriptEvaluator.evaluateString(ScriptEvaluator.java:118)
com.glide.script.ScriptEvaluator.evaluateString(ScriptEvaluator.java:82)
com.glide.script.fencing.GlideScopedEvaluator.evaluateScript(GlideScopedEvaluator.java:309)
com.glide.script.fencing.GlideScopedEvaluator.evaluateScript(GlideScopedEvaluator.java:214)
com.glide.script.fencing.GlideScopedEvaluator.evaluateScript(GlideScopedEvaluator.java:201)
com.glide.rest.service.custom.CustomService.runScript(CustomService.java:96)
com.glide.rest.service.custom.CustomService.execute(CustomService.java:83)
com.glide.rest.handler.impl.ServiceHandlerImpl.invokeService(ServiceHandlerImpl.java:37)
com.glide.rest.processors.RESTAPIProcessor.process(RESTAPIProcessor.java:290)
com.glide.processors.AProcessor.runProcessor(AProcessor.java:531)
com.glide.processors.AProcessor.processTransaction(AProcessor.java:229)
com.glide.processors.ProcessorRegistry.process0(ProcessorRegistry.java:188)
com.glide.processors.ProcessorRegistry.process(ProcessorRegistry.java:177)
com.glide.ui.GlideServletTransaction.process(GlideServletTransaction.java:31)
com.glide.sys.Transaction.run(Transaction.java:2147)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
java.lang.Thread.run(Thread.java:748)
1 ACCEPTED SOLUTION

Xavier Cordero
Kilo Sage

Hello,

Is this in the Service Portal, Native view, or both? If it's in the Service Portal it could be that your Service Portal page is still using the outdated Catalog widget "widget-sc-cat-item" instead of the new "widget-sc-cat-item-v2" Service Catalog item widget. In the newer versions of ServiceNow the old widget can cause issues since it has been deprecated.

View solution in original post

3 REPLIES 3

Xavier Cordero
Kilo Sage

Hello,

Is this in the Service Portal, Native view, or both? If it's in the Service Portal it could be that your Service Portal page is still using the outdated Catalog widget "widget-sc-cat-item" instead of the new "widget-sc-cat-item-v2" Service Catalog item widget. In the newer versions of ServiceNow the old widget can cause issues since it has been deprecated.

You are correct and HI assisted with same resolution.

To confirm for others benefit:

We had catalog item widget "Catalog Item Deprecated" instead of  the new one.

Using the new widget fixed all issues!

Thanks.

PS.  You quickly tell the difference: the deprecated one has the submit button at the foot of the form, the new one has the submit button permanently at the top on the right side.

Thank you, I was stuck since last 2 days for the same issue and you solution helped me