Calling Packed java in application scopes

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-29-2016 12:41 AM
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
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-29-2016 03:08 PM
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.
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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-29-2016 07:18 PM
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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-29-2016 09:52 PM
I will check with our developers and see what they say. Stay tuned.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-30-2016 03:08 PM
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.