How can I create an attachment from script?

Joey Wan Kenobi
Tera Guru

Does SN offer any API to create an attachment?  I've used the following:

 

var gsa = new GlideSysAttachment(); var attachmentId = sa.write(gr, "fileName.txt", 'text/plain', "some data");

 

This works fine for creating text files. It doesn't work when trying to create a pdf, doc or docx file. Is there a way to do so?

22 REPLIES 22

Community Alums
Not applicable

Hi Ashutosh,

my requirement was to add the single pdf document to different records.please give me any idea on that

 

HI,


You have that pdf with you? and you only have to add it to records?


Thanks,,

Ashutosh

Community Alums
Not applicable

I have PDF.this document how to add to the bulk of records(through Background/SJ scripts).Please replay me ASAP

HI,

 

How many records you have?

Thanks,

Ashutosh

Community Alums
Not applicable

I have 100 records