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.

How to fix GlideTransaction is not allowed in scoped applications

mylamariegoodli
Tera Contributor

I created a Record Producer to create a Security Request [sn_si_request] and when submitting this producer from the Service Portal I get an error message:  GlideTransaction is not allowed in scoped applications

When I Enable All I see the following error:

Evaluator: java.lang.SecurityException: GlideTransaction is not allowed in scoped applications Caused by error in sys_ws_operation.4b9f0a8967101200d22b794717415a30.operation_script at line 1 ==> 1: if (GlideTransaction.get().getRequest()) {var uri = gs.action.getGlideURI();var sys_id=uri.get('sysparm_id');if(!sys_id) sys_id = uri.get('sys_id');var gr = new GlideRecord('sc_cat_item');gr.get(sys_id);new SMTemplates().getCatalogItemDefaultDescription(gr);}

sys_ws_operation.4b9f0a8967101200d22b794717415a30 = Submit a Record Producer Scripted REST Resource

Any ideas on how I can prevent this error?

1 REPLY 1

Masha
Kilo Guru

Pull that code out of the 'Default value' on your Description and put it into a global Script Include, returning the last line of the code. Then call that Script Include from Default value field and that should take care of the error.