Why is GlideSysAttachment.getContentBase64() documented, but not defined?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-22-2017 02:08 AM
I am pretty confused about this matter... I need to get the Base64 content of an attachment, so I went to the documentation and it recommends to use the function GlideSysAttachment.getContentBase64(): https://developer.servicenow.com/app.do#!/api_doc?v=geneva&id=r_SGSA-getContentBase64_GR
Though that function just does not exist in the system? It always keep popping up undefined...
When I run:
var sa = new GlideSysAttachment();
gs.print(typeof sa.getContentBase64);
var a = [];
for (var x in sa) {
a.push(x);
}
a.sort();
gs.print('\n'+a.join('\n'));
I get the following output, which does not contain the function I need... So why is it not there, while it is in the documentation? I tried this on Geneva, Helsinki and Istanbul...
*** Script: undefined
*** Script:
DBImageAttachmentRecord
addEncryptionContexts
allAttachments
asStream
attachmentRecord
attachments
attachmentsForExtensions
bytes
bytesUnsafe
canRead
changeEncryptionContext
class
contentStream
contentType
delete
deleteAll
deleteAllAttachments
deleteAttachment
equals
errorFileName
errorMessage
exists
fileDescriptor
fileName
fixImageDimensions
get
getAllAttachments
getAsStream
getAttachmentRecord
getAttachments
getAttachmentsForExtensions
getBytes
getBytesUnsafe
getClass
getContentStream
getContentType
getDBImageAttachmentRecord
getErrorFileName
getErrorMessage
getFileDescriptor
getFileName
getInputStream
getParameter
getParameters
getSizeBytes
getSysID
getTableName
getTableSysID
hashCode
imageDimensions
inputStream
loadParameters
notify
notifyAll
parameter
parameters
processRequest
read
readByName
readToFile
renameAttachment
replaceContent
setContentType
setFileName
setImageDimensions
setInputStream
setStreamCipher
setStreamMonitor
setTableName
setTableSysID
sizeBytes
streamCipher
streamData
streamMonitor
sysID
tableName
tableSysID
toString
wait
write
writeContentStream
writeFromRequest
writeInvisible
writeParts
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-22-2017 02:16 AM
Hi Peter,
Have you missed the parenthesis?
gs.print(typeof sa.getContentBase64());
Thanks
Please Hit like, Helpful or Correct depending on the impact of the response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-22-2017 02:38 AM
Not really... I do not want to evaluate the function. I just want to check it exists

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-22-2017 06:40 AM
Hi Peter,
You've linked to the documentation for the scoped API, but the use of gs.print() in your code suggests you're working in the global scope. I believe getContent and getContentBase64 are only available in scoped apps while you have to use getBytes in the global scope.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-22-2017 07:32 AM
I'm working on Incident, so yes it will be in the global scope. Though getBytes only returns 5MB and not the full size, so that would not work either.