- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-20-2019 01:47 AM
Can we fetch file name from SFTP server and replace the path of data source?
As of now i am able to replace path using script(mentioned below) in Scheduled Import Per-script. Kindly let me know if i will be able to fetch file name from SFTP server using script.
var path =("/StaticName.csv");
var grd = new GlideRecord('sys_data_source');
grd.addQuery('sys_id', '2hcage521b6g63c0c0df29877e4bcbfa');
grd.query();
while(grd.next()){
grd.file_path = path;
grd.update();
gs.log(path);
}
Solved! Go to Solution.
- Labels:
-
Integrations
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-20-2019 04:12 AM
Hi Bhaskar,
if naming convention is not followed then you can't fetch the file from that sftp folder although single file exists in that folder at the time of fetching, ServiceNow would require exact file name to be fetched from sftp folder location.
Mark Correct if this solves your issue and also mark 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
‎08-19-2024 04:02 AM
Hi @Ankur Bawiskar ,
How can we fetch the exact file name if naming convention is followed using schedule job
var path =("/StaticName.csv");
var filename = "filename.xlsx"
var grd = new GlideRecord('sys_data_source');
grd.addQuery('sys_id', '2hcage521b6g63c0c0df29877e4bcbfa');
grd.query();
while(grd.next()){
grd.file_path = path;
grd.update();
gs.log(path);
}