Last active
August 24, 2022 16:10
-
-
Save thisnameissoclever/c242a267e8fddf1b81ff0c8eab3b6ade to your computer and use it in GitHub Desktop.
Fallback method for calculating MD5 hashes for ServiceNow attachments. Requires HI ticket to access to the calculateMD5CheckSum() method of the GlideChecksum class from ServiceNow.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var grAttachment = new GlideRecord('sys_attachment'); //the table where attachment metadata is stored | |
grAttachment.get('0003ea666f015600623008efae3ee4f7'); //sys_id of a record in the sys_attachment table | |
var md5HashSum = calculateMD5Hash(grAttachment); | |
function calculateMD5Hash(attachmentGR) { | |
var attachmentInputStream = GlideSysAttachmentInputStream(attachmentGR.sys_id + ''); | |
var chksum = (new GlideChecksum()).calculateMD5CheckSum(attachmentInputStream); | |
gs.print(chksum); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment