DataSource multiple files to take the latest attached file to load data

rad2
Mega Sage

Currently, the file that is attached first is taken into consideration when loading the records to import set table.

Is there any way to specify the file name or take the latest attached file to the data source

3 REPLIES 3

HarshaVardV
Tera Contributor

Did you get solution for this?

 

Hi Harsha,

No i have not found a direct solution.

In my case the file was loaded from a REST call.

so before adding the file. i have removed the attachment from the import set record(the file is still available in the sys_attachment table for reference) and then attach the new file to the data source. 

 

Thank you

Simon Christens
Kilo Sage

There are 2 possibilitites to handle this from what I can come up with.

1. In the transform map - create an onComplete script that looks up the attachment from the Data source record and deletes the file to ensure that theres only 1 file present at any time.

2. Use the import set API to directly upload and handle each new file

https://<instance>.service-now.com/sys_import.do?sysparm_import_set_tablename=<staging_ table_name>&sysparm_transform_after_load=true

This will create a new Data source with the file attached to it and load and transform the data from the file directly.