What is the sys_id gs.executeNow() is returning?

JDX7913
Tera Guru

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
	}
}
10 REPLIES 10

RAHUL YADAV9
Mega Guru

This post might help you to find the table name from where you are getting that sysid

https://community.servicenow.com/community?id=community_question&sys_id=bda11b6ddbdcdbc01dcaf3231f961949

 

Feel free to mark correct and helpful.

Aman Kumar S
Kilo Patron

executeNow(GlideRecord job)

Executes a job for a scoped application.

You can only use this method on a job in the same application as the script calling this method.

Parameters
Name Type Description
job GlideRecord Job to run.
Returns
Type Description
String Returns the sys_id of the scheduled job. Returns null if the job is global.

 

 

Feel free to mark correct, If I answered your query.

Will be helpful for future visitors looking for similar questions 🙂

Best Regards
Aman Kumar

Aman Kumar S
Kilo Patron

Check below screenshot:

 

find_real_file.png

 

Feel free to mark correct, If I answered your query.

Will be helpful for future visitors looking for similar questions 🙂

Best Regards
Aman Kumar

Hmm, that doesn't make any sense, though.

The scheduled job sys_id I am passing in is "fc2bcbf2db9a451077953b98f4961920," if that doc is to be believed then I should be getting "fc2bcbf2db9a451077953b98f4961920" back as a return but I am getting another sys_id "f60a3a1edb3f8d9036890825ca9619bb"