How to call a scheduled job from scoped application?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-24-2015 03:37 AM
I am trying to call scheduled job from my UI action in my scoped application. But it gives me an error saying "SncTriggerSynchronizer is not allowed in scoped applications".
Can anyone please tell me how I can overcome this error?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-27-2015 04:39 PM
Hi Asit,
Have you considered adding your call to the scheduled job from a Script Include which is marked as Accessible from All Application Scopes. Refer to section 3.1 on the below link.
Scripting in Scoped Applications - ServiceNow Wiki
I hope this helps.
Thanks,
Berny
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2016 12:58 AM
Hey Berny,
Thanks for the response, I did try that but it didn't work. Making my script include public or private will reflect on the script include itself. If I make my script include public, I can use that script from any other application, that does not mean I can trigger scheduled job, since that is still private and it has the restricted access. When I tried your suggested approach, all the script above my SncTriggerSynchronizer.executeNow(rec) runs perfectly but not anything after this function.
Thanks,
Asit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-04-2016 11:14 PM
Hi Asit,
I hope you're doing well!
Do you have any further questions? If not, do you believe you can mark the response as correct so that we can close this thread?
Thanks,
Berny
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-25-2016 11:10 AM
Hi Asit,
Here is how you can do what you want:
//Global scope
SncTriggerSynchronizer.executeNow(rec);
//Scoped app
gs.executeNow(rec);