logo

NJP

Make an update set as your current update set via Script

Import · Jan 04, 2019 · article

Here is how you can make an update set as your current update set.

Example:

var gsus = new GlideRecord("sys_update_set");

gsus.initialize();

gsus.application ='global';

gsus.name = 'Myupdateset_v1';

gsus.description = 'Make it as current';

var upsetsysid = gsus.insert();

var gus = new GlideUpdateSet();

gus.set(upsetsysid );

Note: sometimes the update set will not show immediately on the top bar [view current update set]. Just refresh the page and it will show. Also, you really don't need to worry about whether your updates are storing in the current update set. It will store in the newly created update set only even though it is showing the wrong update set at the top bar.

View original source

https://www.servicenow.com/community/developer-articles/make-an-update-set-as-your-current-update-set-via-script/ta-p/2322774