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

Thank you for the feedback Kumar.