moving images with update sets
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-16-2016 06:26 AM
I am working on a service catalog. When I add both images and icons to my catalog items and migrate my update sets to another instance, I don't see the images and icons on the service catalog in the new instance. What could I be doing wrong?
Thanks.
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-15-2023 07:52 PM
Thanks for this, @Ripu Daman1 . I used some of your code to make a UI Action to allow me to put an individual catalog item's images into an update set.
For anyone else looking for a method of adding images to update sets on demand can create this form link UI Action:
//Commit any changes to the record
current.update();
//Query sys_attachment record for current record. Send to addAttachmentToUpdateSet func
var att = new GlideRecord('sys_attachment');
att.addQuery('table_sys_id',current.getUniqueValue());
att.query();
while(att.next()) {
addAttachmentToUpdateSet(att);
}
//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('Cat Item Images included in <a href="sys_update_set.do?sys_id=' + setID + '">' + us.name + '</a> update set.');
action.setRedirectURL(current);
function addAttachmentToUpdateSet(attachmentGR) {
//Add sys_attachment record to the current update set
var um = new GlideUpdateManager2();
um.saveRecord(attachmentGR);
//Query sys_attachment_doc table for records referencing the sys_attachment record
var attDoc = new GlideRecord('sys_attachment_doc');
attDoc.addQuery('sys_attachment',attachmentGR.sys_id);
attDoc.query();
while(attDoc.next()) {
//Add sys_attachment_doc record to the current update set
um.saveRecord(attDoc);
}
}