The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Push data to an update set

dneedham
Kilo Contributor

So I have this code in a UI action and it was working to push data from a category relationship table to an update set but it is frequently not working. It seems odd as to when it will work and when it does not, there seems to be no reason.

 

If you can look at the code and see if there are any problematic areas that would be great. Let me know if you need any more information.

 

 

//Commit any changes to the record  

current.update();  

 

 

//Check to make sure the table isn't synchronized already  

var tbl = current.getTableName();  

 

 

if(tbl.startsWith('wf_') || tbl.startsWith('sys_ui_')  

    || tbl == 'sys_choice' || current.getED().hasAttribute('update_synch')  

|| current.getED().hasAttribute('update_synch_custom')) {  

    gs.addErrorMessage('Updates are already being recorded for this table.');  

    action.setRedirectURL(current);  

} else {  

    //Push the update into the current update set  

    var um = new Packages.com.glide.update.UpdateManager2();  

    um.saveRecord(current);  

       

    //Query for the current update set to display info message  

    var setID = gs.getPreference('sys_update_set');  

    var us = new GlideRecord('sys_update_set');  

    us.get(setID);  

       

    //Display info message and reload the form  

    gs.addInfoMessage('Record included in <a href="sys_update_set.do?sys_id=' + setID + '">' + us.name + '</a> update set.');  

       

    action.setRedirectURL(current);  

}  

1 ACCEPTED SOLUTION

geoffcox
Giga Guru

I don't know if this is the problem, but since Calgary the Packages call has been replaced with the call: GlideUpdateManager2




See https://wiki.servicenow.com/index.php?title=Packages_Call_Replacement_Script_Objects


View solution in original post

2 REPLIES 2

geoffcox
Giga Guru

I don't know if this is the problem, but since Calgary the Packages call has been replaced with the call: GlideUpdateManager2




See https://wiki.servicenow.com/index.php?title=Packages_Call_Replacement_Script_Objects


Masha
Kilo Guru

I think your code comes from here: http://www.servicenowguru.com/system-definition/manual-update-set-inclusion/ Take a look, read the comments and maybe you can find something that have changed(package call replacement) since the last SN update and when you got it last. Good Luck!