How to upload a document in Servicenow

shaik_irfan
Tera Guru

Hi,

 

I have a document which i want to save in attachment table. Just like how we can upload images to image table can we upload the documents in servicneow ?

 

7 REPLIES 7

ccepts
Mega Expert

You can use the paperclip icon to attach documents to the record. Unless I am misunderstanding the question. 

You can also upload images to be used for other configuration purposes. 

Navigate to System UI > Images to upload your images

Thanks for the reply.

 

Sorry if i have confused you, i have a document that i need to upload in attachment table. 

 

I know if we add to any record like incident or problem that will be added but we dont have a direct option to upload a document at attachment table ?

 

 

Jaspal Singh
Mega Patron
Mega Patron

Hi Irfan,

 

Try using below in background script for a check.

var insertattach=new GlideRecord('sys_attachment');
insertattach.initialize();
var gsa = new GlideSysAttachment();
var attachmentId = gsa.write(insertattach, "JaspalTest.txt", 'text/plain', "Data is here");
//JaspalTest-Filename .txt-is type 
//Data is here is the content of the document

 

Try changing .txt to .doc & replace "Data is here" with the content of the word document

@Jaspal Singh 

 

I have a Excel template which is so big, i am confused how to include that in the background script