What is the sys_id gs.executeNow() is returning?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-02-2022 12:13 PM
I have a code on a record producer that fires "gs.executeNow()" to trigger a scheduled data import. When I put "gs.addInforMessages(gs.executeNow())" I am getting a sys_id back, however, what is that sys_id? Is it the sys_id of "concurrent imports sets" or "import sets" because I can't find where that sys_id is located at?
Here is the sample code of gs.executeNow().
function fireTransformMap(){
var exportGr = new GlideRecord("scheduled_import_set");
exportGr.addQuery("sys_id", "fc2bcbf2db9a451077953b98f4961920");
exportGr.query();
if (exportGr.next()) {
gs.addInfoMessage(gs.executeNow(exportGr)); // this is for scoped app, trigger schedule import
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-02-2022 01:37 PM
If that doc is to be believed then the returning sys_id should be the one I am passing in, "fc2bcbf2db9a451077953b98f4961920."
Instead I am getting a new sys_id each time I am running the script (ex, "f60a3a1edb3f8d9036890825ca9619bb").

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-02-2022 09:48 PM
You are getting the sys_id of the scheduled job trigger which can be found on the "sys_trigger" table, please search with the sys_id.
Feel free to mark correct, If I answered your query.
Will be helpful for future visitors looking for similar questions 🙂
Aman Kumar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-02-2022 04:50 PM
Hi,
It's probably returning the instance of the scheduled job.
That is, the job listed in the following list.
https://<instance name>.service-now.com/sysauto_script_list.do

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-02-2022 05:05 PM
Hi,
I've executed the following script in background script.
var jobId = 'b48d371e97f3011086d3b4b3f153aff6';
var now_GR = new GlideRecord('sysauto_script');
if (!now_GR.get(jobId)) {
throw new Error('Unable to find import job');
}
gs.info(gs.executeNow(now_GR));
The result was as follows:
When I click on "available here", it shows me the value of gs.executeNow() is a jobId.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-02-2022 05:09 PM
Hi,
I've executed the following script from background script.
var jobId = 'b48d371e97f3011086d3b4b3f153aff6';
var now_GR = new GlideRecord('sysauto_script');
if (!now_GR.get(jobId)) {
throw new Error('Unable to find import job');
}
gs.info(gs.executeNow(now_GR));
The result is as follows.
Clicking on "1" under "Row Count" shows the following page.