Scheduled Data Import - Execute Now Script

Daniel_O
Tera Expert

Hello, when I create a scheduled data import, I saw that there is a [Execute Now] button, I wanted a way to activate the button via script. I tried using the UI action script:

 

current.update();
SncTriggerSynchronizer.executeNow(current);

 

But when I run the script in the background script my Cimport does not start.

 

Would anyone know how to make it work? 😓

 

I use scheduled data import because I activate concurrent import.

 

------------------

 

It actually worked, for some reason when I tried it it didn't start, but testing it for the 3rd time it worked. Please disregard this post.

3 REPLIES 3

dp11
Tera Guru

Hi,

 

I am needing the same and calling the code from a runscript inside a workflow:

 var gr_job = new GlideRecord("sysauto");
 gr_job.addQuery("sys_id", "03079e3c0a0a3caa00c0524667b4d967");
 gr_job.query();
 if (gr_job.next()) {
        gr_job.update();
        SncTriggerSynchronizer.executeNow(gr_job);
        gs.log("Successfully executed the Scheduled Job");
    } else {
        gs.log("Failed to find the Scheduled Job");
    }
 
But the WF activity throws an error:
 
dp11_0-1715106072426.png

 

Any idea why?

 

Thanks,

Deb

dp11
Tera Guru

The error happens right at the line:

 var gr_job = new GlideRecord("sysauto");'
 
Did you not have this line in your script?

dp11
Tera Guru
   Never mind. I had to use:
var gr_job = new GlideRecord("scheduled_import_set");