Use of Packages calls is not permitted in scoped applications

Kumar Tella
Mega Expert

I am trying to convert datetime string in GMT to EST in a processor which is a scoped application script where user session is not available to use gs.getSession().getTimeZone() object. So I am trying to use package call, my script is below.

  var xDateGMT = '2015-12-17 15:39:31.179';

  gs.log ( 'Date in GMT: ' + xDateGMT);

  var utz = Packages.java.util.TimeZone.getTimeZone("US/Eastern");

  var gdt = new GlideDateTime(xDateGMT);

  gdt.setTZ(utz);

  var xDateUTZ = gdt.getDisplayValue();

  gs.log ( 'Date in UTZ: ' + xDateUTZ);

When I run this, getting java.lang.SecurityException: Use of Packages calls is not permitted in scoped applications.

Any help is appreciated.

Thank

Kumar

PS: This is for xMatters ondemand integration with SN, xMatters is sending the response.date in GMT and we are updating the incident with response and need to convert the GMT to EST.

5 REPLIES 5

rilinda_lamllar
Kilo Contributor

Hi Kumar,


Did you find anything about this? I am also facing the issue now with GlideURL() call. I think must be a trick somewhere how to call them, otherwise would be too limiting.



Thanks,


Rilinda


Hi Rilinda,



I did not find any solution yet, We opened a hi ticket with ServiceNow and waiting for their answer. I will update here once I hear.



Thanks


Kumar


How did achieve the resolution for the same?

Kumar Tella
Mega Expert

Per ServiceNow tech support, Java code is not allowed in the scoped applications. That is why we are getting the exception.