Skip to content

Instantly share code, notes, and snippets.

View ThayaneLais's full-sized avatar
🎯
Focusing

ThayaneLais

🎯
Focusing
View GitHub Profile
@thisnameissoclever
thisnameissoclever / copySpecificAttachment.js
Last active December 4, 2024 12:42
ServiceNow script to copy a specific attachment from one record to another
copySpecificAttachment(donorTable, donorID, recipientTable, recipientID, fileName);
function copySpecificAttachment(donorTable, donorID, recipientTable, recipientID, fileName) {
var donorAttSysID,
grNewAttachment,
linkToNewRecord,
attDataRecord,
newDocRecord,
grAttachment = new GlideRecord('sys_attachment');
grAttachment.addQuery('table_name', donorTable);