- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-21-2021 09:07 AM
I have a Scheduled Job, that is executed via a Scheduled Script execution. I would like to provide this functionality On Demand to certain personnel, without exposing the script to them.
Is it possible to have a UI Action in a content block on a page (home page or UI page) that can run this script onclick?
I currently have a UI page with a function in the Client script as follows:
function runscript() {
var scheduleReport = new GlideRecord("sysauto_script");
scheduleReport.get('0121c1733cc03010a2f3714242bc086c'); //Sys_id of the Scheduled job
SncTriggerSynchronizer.executeNow(scheduleReport);
}
But I am getting an error of SncTriggerSynchronizer is not defined.
If I plug the exact code from the Scheduled Script into a Module - Script from Arguments, it will run fine, but returns to the Background Script screen, which is not the experience I want my users to have.
Thanks, in advance, for any help!
Jeanne
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-21-2021 09:26 AM
Hi,
You can do the GlideAjax call as noted, or place the script you mention in your post in the processing script (server side) of the UI Page. That script is supposed to run server side, not client.
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-21-2021 09:08 AM
Call a glideajax, and move the script to your script include.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-21-2021 09:17 AM
Use glideajax in the Client Script and put the Schedule Script in a script include or the script above in a script include?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-21-2021 09:26 AM
Hi,
You can do the GlideAjax call as noted, or place the script you mention in your post in the processing script (server side) of the UI Page. That script is supposed to run server side, not client.
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-24-2021 06:49 AM
This is actually what I ended up doing to make it work. I had actually tried this first, and couldn't get it working. Turns out it really helps to have the button type set to "submit" vs. "sumbit". Sigh...