Is it possible to capture scheduled job code in an update set?

Myron Smith
Giga Contributor

We have created a scheduled job in an update set. Is it possible to push these changes in an update set vs pushing xml? We have been told scheduled job code can't be pushed via update set and we would like to confirm.

7 REPLIES 7

Ankur Bawiskar
Tera Patron
Tera Patron

@Myron Smith 

Out of the box they are not captured.

But here is an alternative if you wish to push it to an update set

Manually Add a Record to an Update Set

Steps

1) ensure you are in correct update set

2) run this script in background script

//Query for the record
var rec = new GlideRecord('sysauto_script');
rec.get('973c8e8a9d022000da615b13b3a22f32'); // give the sysId of scheduled job here
//Push the record into the current update set  
var um = new GlideUpdateManager2();
um.saveRecord(rec);

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Ian Mildon
Tera Guru

When you are viewing the Scheduled Job you should see this Related Links option:

find_real_file.png

So, as long as you are currently in the correct Update Set, clinking the link will capture the Scheduled Job (and all the conditions/script) in the Update Set. Please note that you will need to do this every time you make an update to the Scheduled Job while developing/testing it.

Mohith Devatte
Tera Sage
Tera Sage

Please refer to this below  blog on what i said about "Add to update set" Action

https://developer.servicenow.com/connect.do#!/share/contents/9824957_add_to_update_set_utility?v=7.3&t=PRODUCT_DETAILS

Please accept the solution if you find it useful