Programmatically add objet to updateset

Bruno Leclerc
Kilo Expert

Hi,

In background script I can add an object to the current update set with the following code :

var rec = new GlideRecord('sys_script_include');
rec.get('bb1917f6dbda58901d764cb115961990');
new GlideUpdateManager2().saveRecord(rec);
The object is well added to the current updateset however I systematically have this message :

Version was not added, it is a duplicate of the latest existing one: sys_script_include_xxxx/FOX_SI_Objet
Could you please tell me why ?

Thanks.

(
I haven't seen anything about it online ... )


 

4 REPLIES 4

Community Alums
Not applicable

Hi @Bruno Leclerc ,

Refer to this thread:

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

 

Mark my answer correct & Helpful, if Applicable.

Thanks,

Sandeep

alas, another dead link from the community.

Makes me wonder why we bother when so many links back to old articles are either zapped or "archived"

Do they not realise that these are useful

Yes, found this as I have the same problem adding some records (sys_choice entries) to an update set (add to update set is not doing it either).

I cannot see the updates in an update set - anywhere except for the one that is a DELETE - nope, no idea why when I am tryring to ensuring what is in the list is captured in the update set and the bod doing the release does not need to import an XML

 

I can see in a release a few weeks ago an update set has a set of choices for what it required, so it is not me going mad.

Mine was due to this KB

New [sys_choice] records should show as an INSERT OR UPDATE in the Update Sets but instead are incor...

 

Incae the above is zapped:

In essence, I had created sys_choice entries so I could collate via a list collector

table_name = sc_cat_item

element = <name of variable>

 

This works, but as there is no sys_choice set, it will not add to the update set.

Go to sys_choice set.

Create a new entry

table_name = sc_cat_item

element = <variable>

 

go back to the sys_choice_set record.  

Use add to update set

All good