Name
sn_cd.cd_AttachmentAjax
Description
No description available
Script
var cd_AttachmentAjax = Class.create();
cd_AttachmentAjax.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {
process: function() {
if (this.getType() == "delete")
this.deleteAttachment();
else if (this.getType() == "deleteMultiple")
this.deleteAttachments();
},
deleteAttachment: function() {
var s = new GlideSysAttachment();
var attachmentId = this.getValue();
if (!attachmentId)
return;
s.deleteAttachment(attachmentId);
},
deleteAttachments: function() {
var s = new GlideSysAttachment();
if (!this.getValue())
return;
var allIds = this.getValue().split(",");
for (var i = 0; i < allIds.length; i++) {
try {
if (allIds[i])
s.deleteAttachment(allIds[i]);
} catch (e) {
gs.error("Content Publishing: cd_AttachmentAjax - Unable to delete the record with Sys_id-" + allIds[i] + ". Failed with:" + e);
}
}
},
type: "cd_AttachmentAjax"
});
Sys ID
06d3015077b501106220a5424f5a998f