- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2023 04:15 PM
I expect to see the option to add to update set but I don't see it.
I don't see it in the actions either.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2023 06:28 AM
Ah, it is a custom UI Action.
For the form link:
addToUpdateSet();
function addToUpdateSet(){
//Get current URL for return
var url = GlideSession.get().getStack().bottom();
//Save current record
current.update();
//Initialize updateManager
var updateManager = new GlideUpdateManager2();
//Add record to update set
updateManager.saveRecord(current);
//If the current record is an attachment, add the chunks
//(Attachments and chunks for other record types are auto-added)
if (current.getTableName() == 'sys_attachment')
addAttachmentChunks(current);
//If attachments are not detected, check the sys_attachment table anyway
//(Known attachments are auto-added, missing unknown attachments)
//(sys_user seems to be an exception)
else if (!current.hasAttachments() && current.getTableName() != 'sys_user')
addAttachments(current);
//Display confirmation
var currentSet = new GlideRecord('sys_update_set');
currentSet.get(gs.getPreference('sys_update_set'));
gs.flushMessages(); //Flush to avoid multiples when list updating
gs.addInfoMessage('Record(s) added to update set ' + currentSet.name + '.');
action.setRedirectURL(url);
}
//Add attachments to the update set
function addAttachments(record){
var updateManager = new GlideUpdateManager2();
var attach = new GlideRecord("sys_attachment");
attach.addQuery("table_sys_id", record.sys_id.toString());
attach.query();
while (attach.next()) {
//Process main sys_attachment record
updateManager.saveRecord(attach);
//Process sys_attachment_doc chunks
addAttachmentChunks(attach);
}
}
//Add attachment chunks to the update set
function addAttachmentChunks(attachment){
var updateManager = new GlideUpdateManager2();
var attach_doc = new GlideRecord("sys_attachment_doc");
attach_doc.addQuery("sys_attachment", attachment.sys_id.toString());
attach_doc.orderBy("position");
attach_doc.query();
while (attach_doc.next())
updateManager.saveRecord(attach_doc);
}
I'd make this accessible only to the admin role or some special privileged role.
For List Choice:
addToUpdateSet();
function addToUpdateSet(){
//Get current URL for return
var url = GlideSession.get().getStack().bottom();
//Save current record
current.update();
//Initialize updateManager
var updateManager = new GlideUpdateManager2();
//Add record to update set
updateManager.saveRecord(current);
//If the current record is an attachment, add the chunks
//(Attachments and chunks for other record types are auto-added)
if (current.getTableName() == 'sys_attachment')
addAttachmentChunks(current);
//If attachments are not detected, check the sys_attachment table anyway
//(Known attachments are auto-added, missing unknown attachments)
//(sys_user seems to be an exception)
else if (!current.hasAttachments() && current.getTableName() != 'sys_user')
addAttachments(current);
//Display confirmation
var currentSet = new GlideRecord('sys_update_set');
currentSet.get(gs.getPreference('sys_update_set'));
gs.flushMessages(); //Flush to avoid multiples when list updating
gs.addInfoMessage('Record(s) added to update set ' + currentSet.name + '.');
action.setRedirectURL(url);
}
//Add attachments to the update set
function addAttachments(record){
var updateManager = new GlideUpdateManager2();
var attach = new GlideRecord("sys_attachment");
attach.addQuery("table_sys_id", record.sys_id.toString());
attach.query();
while (attach.next()) {
//Process main sys_attachment record
updateManager.saveRecord(attach);
//Process sys_attachment_doc chunks
addAttachmentChunks(attach);
}
}
//Add attachment chunks to the update set
function addAttachmentChunks(attachment){
var updateManager = new GlideUpdateManager2();
var attach_doc = new GlideRecord("sys_attachment_doc");
attach_doc.addQuery("sys_attachment", attachment.sys_id.toString());
attach_doc.orderBy("position");
attach_doc.query();
while (attach_doc.next())
updateManager.saveRecord(attach_doc);
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2023 04:57 PM
Did you add this utility to you instance?
https://developer.servicenow.com/connect.do#!/share/contents/9824957_add_to_update_set_utility?v=7.3...
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2023 05:56 AM
The plugin is installed by default.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2023 06:03 AM
if you are talking about record so update set did not capture records
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2023 06:04 AM
The transnational data such as incident, change, problem, knowledge, CI's etc data records, scheduled jobs, schedules, users, group, email etc are not get captured in update set.