- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2019 12:22 PM
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
Solved! Go to Solution.
- Labels:
-
Best Practices
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2019 12:49 PM
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2019 12:49 PM
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