Add a tag to attachment via business rule
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-17-2022 02:40 AM
Hi Experts,
I have business rule where I'm trying to add a tag to an attachment on insert/update. Here is my script;
function executeRule(current, previous /*null when async*/) {
var addLabelGR = new GlideRecord('label_entry');
addLabelGR.initialize();
addLabelGR.label = 'f3bc06fbdb414950611353835b96198f'; //change the sys id of the label you want.
addLabelGR.url = 'sys_attachment.do?sys_id=' + attachmentID + '&sysparm_view=';
addLabelGR.table = current.table_name;
addLabelGR.table_key = current.table_sys_id;
addLabelGR.table = sys_attachment;
addLabelGR.notify_onchange = false;
addLabelGR.read = 'yes';
addLabelGR.title = 'Attachment - ' + filename;
addLabelGR.insert();
})(current, previous);
I think in some cases it will create the label but it won't add it to the attachment
Does anyone have any experience of doing this?
Thanks as always
Richard
- Labels:
-
Problem Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-17-2022 02:55 AM
Yes, all it will do is create a tag. For associating it to the record you need a BR on Attachment table that will go in and update the record.