Get PDF file into servicenow from ftp server through midserver and create a request and attach it to the request.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-29-2018 05:24 AM
Hi all,
Below is my requirement.
1.Get a pdf file ,stored in ftp server into service now through a mid server.
2.Create an incident/request and attach the pdf to the same.
note:I'm aware of data sources which don't support file type = pdf.
anyone tried this... Please help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-01-2018 10:32 PM
Hi Suhas,
Following approach has to be taken:
1) Setup a mid server
2) Write mid server script include which will do these 2 things. This will involve java coding somewhat i.e. syntax wise
a) Fetch the file from specified ftp server. You must be having the username and password and file path and file name
b) Send this file to ServiceNow using base64encoded stream i.e. get base64encoded data of this file and send it back
3) Write a business rule on ecc_queue table and create an incident or request etc
4) Get the sys id of the record just now created and using soap attachment creator attach the file to the record
https://docs.servicenow.com/bundle/kingston-application-development/page/integrate/inbound-soap/reference/r_AttachmentCreatorSOAPWebService.html
https://hi.service-now.com/kb_view.do?sysparm_article=KB0546294
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-02-2018 04:09 AM
Hi Ankur,
Thanks for the reply. But i have a question again. Below is my code snippet of mid server script include to write a file from sftp to servicenow .I'm a bit lost here. Please help.
this.output =new Packages.java.io.ByteArrayOutputStream();
this.att = Packages.com.glide.ui.SysAttachment();
function attach(filename)
{
this.att.setTableName('sys_data_source'); //table name of the record
this.att.setTableSysID('9b7153f6db6e5bc004f9f19dae96198d'); //sys_id of the data source record this is being attached to
this.att.setFileName('Test'); //the name of the file as it should appear after it's uploaded
this.att.setContentType('application/pdf');
this.sftp.cd(this.params.filepath);
this.sftp.get(filename,this.output);//to copy file into the output stream
this.input = new Packages.java.io.ByteArrayInputStream(this.output.toByteArray());
this.att.setInputStream(this.input)
this.att.write();
}
How should i get base64 encoded stream and what should happen next?
Sorry , i have too many questions here.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-02-2018 04:47 AM
Hi Suhas,
Steps are as follows:
1) Get the file from ftp server
2) Create a local file on mid server path
3) Get the base64encoded data from this file
4) Send this data back to ecc_queue table using probe.createElement()
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-10-2018 03:47 AM
Hi Suhas,
Any update on this?
Were you able to achieve this?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader