454 views

When submitting a record in the Service Portal, users can be unexpectedly redirected to the record list page, without succeeding to actually submit the form



Overview


When submitting a record in the Service Portal, users can be unexpectedly redirected to the record list page, without succeeding to actually submit the form. 

 

Problem


Setup a record producer to create records on incident table, then setup catalog client on-submit script to redirect user to list page. Access the record producer on Service portal and fill in the mandatory fields and submit the form, this should create a incident record and then redirect user to incident list.

However, this setup doesn't work as expected intermittently, occasionally on submission of form, system redirects user to incident list, before record is created.

 

Symptoms


When the reported issue occurs, we see below error stack on the node logs for that affected user 
=============================================================== 
2017-08-17 01:23:15 (422) Default-thread-2 71E9504B37E44700483F148543990E78 #607859 /angular.do Parameters ------------------------- 
sysparm_ck=b1e95...a3663 (length=72) 
type=sc_cat_item 
sysparm_type=$sp 
2017-08-17 01:23:15 (501) http-30 WARNING *** WARNING *** Resource does not exist: /scs/snc_node_disable.html 
2017-08-17 01:23:15 (511) Default-thread-2 71E9504B37E44700483F148543990E78 SEVERE *** ERROR *** JSONObject["sys_id"] not found. 
org.json.JSONException: JSONObject["sys_id"] not found. 
at org.json.JSONObject.get(JSONObject.java:301) 
at org.json.JSONObject.getString(JSONObject.java:427) 
at com.glide.service_portal.catalog.SPCatalogRequest.create(SPCatalogRequest.java:38) 
at com.glide.service_portal.SPProcessor.processCatItem(SPProcessor.java:85) 
at com.glide.service_portal.SPProcessor.process0(SPProcessor.java:60) 
at com.glide.service_portal.SPProcessor.process(SPProcessor.java:45) 
at com.glide.ui.ng.AngularProcessor.process(AngularProcessor.java:115) 
at com.glide.processors.AProcessor.runProcessor(AProcessor.java:412) 
at com.glide.processors.AProcessor.processTransaction(AProcessor.java:187) 
at com.glide.processors.ProcessorRegistry.process(ProcessorRegistry.java:165) 
at com.glide.ui.GlideServletTransaction.process(GlideServletTransaction.java:49) 
at com.glide.sys.ServletTransaction.run(ServletTransaction.java:34) 
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 
at java.lang.Thread.run(Thread.java:748) 

2017-08-17 01:23:15 (515) Default-thread-2 71E9504B37E44700483F148543990E78 SEVERE *** ERROR *** java.lang.reflect.UndeclaredThrowableException 
java.lang.reflect.UndeclaredThrowableException 
at com.sun.proxy.$Proxy43.getCookies(Unknown Source) 
at com.glide.ui.CookieMan.getCookieFromRequest(CookieMan.java:119) 
at com.glide.ui.CookieMan.getSessionStore(CookieMan.java:335) 
at com.glide.sys.GlideSessionStore.store(GlideSessionStore.java:49) 
at com.glide.processors.AProcessor.processTransaction(AProcessor.java:189) 
at com.glide.processors.ProcessorRegistry.process(ProcessorRegistry.java:165) 
at com.glide.ui.GlideServletTransaction.process(GlideServletTransaction.java:49) 
at com.glide.sys.ServletTransaction.run(ServletTransaction.java:34) 
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 
at java.lang.Thread.run(Thread.java:748) 
Caused by: java.lang.reflect.InvocationTargetException 
at sun.reflect.GeneratedMethodAccessor257.invoke(Unknown Source) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
at java.lang.reflect.Method.invoke(Method.java:498) 
at com.glide.ui.GlideServletRequest.invoke(GlideServletRequest.java:121) 
... 11 more 
Caused by: java.lang.IllegalStateException: The request object has been recycled and is no longer associated with this facade 
at org.apache.catalina.connector.RequestFacade.getCookies(RequestFacade.java:647) 
at com.glide.size_aware.SizeAwareHttpServletRequest.getCookies(SizeAwareHttpServletRequest.java:250) 
... 15 more 

2017-08-17 01:23:15 (519) Default-thread-2 71E9504B37E44700483F148543990E78 #607859 /angular.do -- total transaction time: 0:00:00.101, transaction processing time: 0:00:00.101, total wait time: 0:00:00.000, session wait: 0:00:00.000, semaphore wait: 0:00:00.000, source: 77.66.90.41, chars: 2, uncompressed chars: 0, SQL time: 5 (count: 4), business rule: 0 (count: 0), phase 1 form length: 0, largest chunk written: 2, request parms size: 208, largest input read: 0 
2017-08-17 01:23:15 (854) http-31 New transaction 71E9504B37E44700483F148543990E78 #607860 send /amb/meta/disconnect 
========================================================================= 

 

Possible Cause


There can be various reasons for the reported issue, we are covering one of the possible cause in this article.

On-submit of the record producer, seems to be there is a race condition happening with the on-submit client script and submit action of record producer. In some situations intermittently on-submit goes ahead of the actual submit request and hence causing the user to be redirected before actually record is submitted. 

 

Workaround


In order to work-around the issue, following are the options, 
 
  • Delay the redirect for 2 seconds with below code: 

===================================== 

function onSubmit() { 


//Make the redirection to happen after 2s. Meanwhile the request gets submitted successfully. 

setTimeout(function(){ top.window.location = '/sp?id=requests'; }, 2000); 



===================================== 

  • De-activate the redirect client script and handle the redirect in a different way, for example with the record producer redirect or redirect with the sc_cat_item widget. 
 

Article Information

Last Updated:2017-12-13 11:22:31
Published:2017-12-13