retrieve SFTP data
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-29-2013 11:48 AM
Hi,
How to retrieve the SFTP data into service now..
Any suggestions would be great help!
- Labels:
-
Integrations
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-29-2013 12:04 PM
Just create a Data Source and in the File Retrieval Method you can choose SFTP. and set up all your credentials and paths accordingly and test it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-02-2013 01:44 PM
Hi Jason,
Thanks a lot for the information!
I have created a data source with all set up like file path, import set table etc and I can able to load the data from the SFTP.
The challenge is I will get the data every day with the below format
YYYYMMDD.csv.
So I am thinking of schedule the file import daily but I am not sure how to implement this.
Could you please help on this..
Thanks,
Lokesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-02-2013 02:02 PM
The solution that I sent automatically processes it once it comes in. But if your data source record is always the same record, you just create a scheduled import and select the data source.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-07-2013 07:25 AM
Hi Jason,
Thanks for the information Jason..!
I have created the scheduled import and selected the required datasource. Its working fine.
The challenge is file name changes every day in the sftp server..
example: YYYYMMDD.csv.
I am thinking of updating the file path in the Datasource form with the below script. but its not updating the file path to the current date in datasource.
I am writting below script after checking the execute pre-import script in the scheduled import form.
Could you please help me on this..?
var ds = new GlideRecord('sys_data_source');
ds.addQuery('name', 'name of the datasource');
ds.query();
while(ds.next()) {
var d = GlideDate();
// d.addDays(-1);
var dayOfMonth = d.getDayOfMonth().toString();
if (dayOfMonth.length == 1) {
dayOfMonth = '0' + dayOfMonth;
}
var month = d.getMonth().toString();
if (month.length == 1) {
month = '0' + month;
}
var year = d.getYear().toString();
var filename = 'CWY_EMP_' + year + month + dayOfMonth + '.csv';
// var filename = 'CWY_EMP_20130806.csv';
current.file_path = "/cwyibmsftp/from_conway/" + filename;
//current.u_postscript = "rm /apps/people-crypt1/" + filename;
current.update();
}