Built something you're proud of? Tell the story. A quick G2 review of App Engine or Build Agent helps other developers see what's possible on ServiceNow. Share your experience.

Unable to use Packages.com.glide.schedules.Schedule property

shaik_irfan
Tera Guru
Security restricted: Attempted access to restricted class name com.glide.schedules
Evaluator: java.lang.SecurityException: Illegal attempt to access class 'com.glide.schedules' via script Caused by error in script at line 3 1: var schedRec = new GlideRecord('cmn_schedule'); 2: schedRec.get('name', '8-5 weekdays'); ==> 3: var sched = new Packages.com.glide.schedules.Schedule(schedRec.sys_id);
9 REPLIES 9

Jon Barnes
Kilo Sage

Usually, you would just use var sched = new GlideSchedule(schedRec.sys_id) now. the Packages calls should be phased out.

What do you mean ? You mean to say i shounld not use Packages calls ?

 

If i understand wrong can you please help me out with the syntax ? Just curios to understand does it required any property to be set or enabled ?

Yes, Packages calls aren't used anymore, they were migrated to Glide objects. I put the replacement line of code in my initial response. GlideSchedule should be used instead of your package call.

Aman Gurram
Giga Expert

How about using the GlideSchedules the way the below way

 

var sched = new GlideSchedule();
sched.load('sys_id of the schedule'); //sys_id of the schedule used i.e. Mon - Fri