scripted file path

Srinidhi Hari E
Kilo Contributor

Hello,

I have a requirement to dynamically set the file path for scheduled import.

The issue here is that the file path contains the date and time on which it was uploaded to the site, like ninja_20160523123235.csv (format : yyyymmddhhmmss ). If the second is 35 today ,it can be 47 tommorrow .While the date,hour,minutes can be computed somehow, the seconds change according to the upload time.Can just the seconds be given as a wildcard when setting the value dor file path ? Possible ? Please let me know a way of scripting this or doing this any other way !!

Thanks.

1 ACCEPTED SOLUTION

Chuck Tomasi
Tera Patron

Hi Srinidhi,



I think I understand what you are doing. You've got a file on some remote system and you want ServiceNow to import it. Passing the date/time as a parameter is going to be tricky. I can see two options for you.


  • Using Orchestration, get a file listing of the FTP site and take the highest numbered file to get the latest file.
  • Update the source system to name the file "ninja_latest.csv" with a dated copy "ninja_20160523123235.csv" so you can always be sure you are getting the latest copy, but still have a dated archive copy in the event you need to run the import manually.


The first has a cost associated with it (Orchestration licensing), but adds a lot of power to you system. The second assumes you have access to the software or system placing files on the FTP server.



I hope that helps.


View solution in original post

5 REPLIES 5

Chuck Tomasi
Tera Patron

Hi Srinidhi,



I think I understand what you are doing. You've got a file on some remote system and you want ServiceNow to import it. Passing the date/time as a parameter is going to be tricky. I can see two options for you.


  • Using Orchestration, get a file listing of the FTP site and take the highest numbered file to get the latest file.
  • Update the source system to name the file "ninja_latest.csv" with a dated copy "ninja_20160523123235.csv" so you can always be sure you are getting the latest copy, but still have a dated archive copy in the event you need to run the import manually.


The first has a cost associated with it (Orchestration licensing), but adds a lot of power to you system. The second assumes you have access to the software or system placing files on the FTP server.



I hope that helps.


If you found my previous answer to be correct, would be so kind as to mark it as correct, it will show up as "Answered" for people doing a search on the same question/issue.


Thanks.


prabh
Mega Expert

I also have the exact same requirement.


Could you please explain the option 2 in detail again.


Hi Prabh,



I cannot provide details because it depends on the source system, not ServiceNow. The idea is that on day 1 you would have a file



ninja_latest.csv       <<-- Day 1 data


ninja_20170530.csv <<-- Copy of day 1 data



On day 2 you would have



ninja_latest.csv <<-- Day 2 data


ninja_20170531.csv <<-- Copy of day 2 data


ninja_2070530.csv <<-- Same Day 1 data as before



That way ServiceNow is always picking up the latest info from "ninja_latest.csv", but still has access to archive copies if necessary. How this is done depends on the software used to generate the CSVs on the other end.