Issue using Flow Designer to load and transform data from a Data Source

Javeria
Tera Contributor

I have a data source with 3 transform maps attached to it and a scheduled job triggered from flow. The flow first fetches data from a third party and uploads the attachment to the data source. Once that’s done, the scheduled job is run from the flow via a script action.

The issue is that the REST call runs multiple times in the same flow (using a do-while loop). Before uploading the next file, we need to delete the previous attachment; otherwise, the load step fails with an error saying no/more than 1 file attached. I tried adding a postscript on the scheduled job to delete attachments, but that isn’t working.

Is there a way to always pick the most recent file from the data source for load & transform?

As an alternative, I tried using GlideImportSetLoader and GlideImportSetTransformerWorker, but that throws errors in the scoped app (HR Integrations). We also want to avoid putting this code in a global script include and then calling it from the HR scope.

Any guidance or best practices would be appreciated.

@Ankur Bawiskar 

1 REPLY 1

Ankur Bawiskar
Tera Patron
Tera Patron

@Javeria 

I will suggest before adding file to Data source, always delete the existing one and then attach new one.

with this you will always have latest file on data source.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader