Need to Create the .txt file in workflow

san1989
Giga Guru

Hi,

We need to create the .txt file in ServiceNow . Records should be inserted in text file (RITM Variables).

How to create the text file in servicenow. Are there any specific methods to create the text file in servicenow?

Please let us know. Thanks

1 ACCEPTED SOLUTION

Nitin Panchal
Tera Guru

Hi ,

 

Here is the script to create Text file and attach to record. 

 

 

var attachment = new Attachment();
//attachment.write('TablenameFileToAttach','SysIDOfRecord','Filename','TypeOffile','ContentOfFile')
var attachmentRec = attachment.write('sc_req_item', '19647519db940010343688094896193b', 'TextFile'+".txt", "text", "Test file attached");

 

Attachment write doc - https://developer.servicenow.com/app.do#!/api_doc?v=madrid&id=r_SGSA-write_GR_S_S_S

 

Please mark correct answer if this has answered your question.

Thanks,
Nitin

View solution in original post

1 REPLY 1

Nitin Panchal
Tera Guru

Hi ,

 

Here is the script to create Text file and attach to record. 

 

 

var attachment = new Attachment();
//attachment.write('TablenameFileToAttach','SysIDOfRecord','Filename','TypeOffile','ContentOfFile')
var attachmentRec = attachment.write('sc_req_item', '19647519db940010343688094896193b', 'TextFile'+".txt", "text", "Test file attached");

 

Attachment write doc - https://developer.servicenow.com/app.do#!/api_doc?v=madrid&id=r_SGSA-write_GR_S_S_S

 

Please mark correct answer if this has answered your question.

Thanks,
Nitin