Calling Packed java in application scopes

David Vu1
Kilo Expert

Hi talent,

I rewrite a code which write in global to my application :
var globalMap = new Packages.java.util.HashMap();

But it reponse that :


Use of Packages calls is not permitted in scoped applications

Has anyone experienced it before?


Thanks,Hao Duong

10 REPLIES 10

Chuck Tomasi
Tera Patron

Hi Hao,



Package calls have been deprecated since Calgary. They caused issues with developers making changes to the API since they were direct calls to explicit Java objects. Instead, we recommend using the GlideScriptable objects for the API. This may help, but really applies to Packages.com.glide (or Packages.com.snc or Packages.com.glideapp) calls.



GlideScriptable object name



You are making a Packages.java.util call.   You might also look at this:



Using the Packages Call Removal Tool - ServiceNow Wiki



Keep a bookmark to this:



Packages Call Replacement Script Objects - ServiceNow Wiki



I seem to recall a feature in Helsinki that allowed you to upload "extensions" to the Java code. I'm looking for that information now and will post it here if I find it.


Thanks ctomasi so much.
I already run
Using the Packages Call Removal Tool - ServiceNow Wiki



But notthing change.



And my problem is a little different, The scripts could run in Global scopes but when i change it to my own scope (custom scope) it not run anymore?
I just think that is there some GlideScript could replace the Packages.java.util ?


Thanks again.


I will check with our developers and see what they say. Stay tuned.


Hi Hao,



Can you help me understand what you were trying to do with the Hashmap method? We may be able to find an alternative for you.