Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

GlideTransaction.get().response.sendRedirect broken in Jakarta / sendRedirect

jean-lucchatton
Kilo Guru

Hello,

Our instance uses a couple of GlideTransaction.get().response.sendRedirect() calls. It was ok on Helskinki version but is broken on Jakarta.

We receive the following error message "Attempted script access to inaccessible member denied - com.glide.sys.Transaction:getResponse:()Ljavax/servlet/http/HttpServletResponse;

Evaluator: java.lang.SecurityException: Illegal access to method getResponse in class com.glide.sys.Transaction".

I've looked in the community forum and find that this API was not documented. Therefore ServiceNow has certainly decided to change something or decided to restrict his usage.

Any idea how to get the same functionality ?

Thanks and regards

Jean-Luc

15 REPLIES 15

After playing around a bit. I got it working with:


g_response.sendRedirect(


ritm.getLink().toString()


);



sees encoding it was adding extra %25 where they weren't needed


Maybe you can share the code in order to compare both methods ?


https://developer.servicenow.com/app.do#!/api_doc?v=kingston&id=c_GlideServletResponseScopedAPI



Processor Script has g_response.sendRedirect()...for temporary client redirection ....



Can we use a processor instead of current Transaction API or maybe inside the current logic maybe we can pass the URL as sysparm_name... as in GlideServletRequest API we have access to HttpServletRequest object.


find_real_file.png


To compare i literally output each part to gs.info and compared with the full URL when loaded a ticket in the browser. I noticed a load of %25's just before 3D. Removed those and all worked ok. So figured it must be the encoding i.e. encodeURIComponent(ritm.getLink(). May not be the same in your case.


Yes I think this is not the same problem,



However your troubleshooting may help others in the same case