Execute schedule report from script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Monday
Hi All,
I'm using below script to trigger a scheduled report from script. Is there a way we can avoid calling packages directly?
var gr=new GlideRecord('sysauto_report');
gr.get('name', 'Report Name'); // name of my schedule report.
if (typeof SncTriggerSynchronizer != 'undefined')
SncTriggerSynchronizer.executeNow(gr);
else
Packages.com.snc.automation.TriggerSynchronizer.executeNow(gr);
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Monday
Yes Friend— you can!
You should avoid calling Packages.* directly.
The clean approach is to rely only on SncTriggerSynchronizer. If it’s not available in your instance, dont fall back to the Java package call; that’s internal and not upgrade-safe.
Simplest safe pattern:
var gr = new GlideRecord('sysauto_report');
gr.get('name', 'Report Name');
if (typeof SncTriggerSynchronizer !== 'undefined') {
SncTriggerSynchronizer.executeNow(gr);
} else {
gs.error('SncTriggerSynchronizer not available – report not triggered');
}If you need more control or compatibility - Fire an event and trigger the report from a Script Action instead. That keeps all the platform specific logic in one place.
Bottom line:
SncTriggerSynchronizer = OK
Packages.* = Avoid if you care about upgrades
@pramodkumar - Please mark as Accepted Solution and Thumbs Up if you find Helpful!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Monday - last edited Monday
Your script is already using the recommended approach. The Packages call is the fallback when SncTriggerSynchronizer is unavailable.
Refer :
Execute Scheduled Jobs: https://community.servicenow.com/community?id=community_question&sys_id=f5318be5db98dbc01dcaf3231f96...
Scoped App Workaround: https://www.servicenow.com/community/developer-forum/schedule-script-using-script/m-p/2760287
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Monday
try this without package call
var gr = new GlideRecord('sysauto_report');
if (gr.get('name', 'Report Name')) { // name of my schedule report.
gs.executeNow(gr);
}
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hope you are doing good.
Did my reply answer your question?
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
