Automatically Call Function after SourceFile.processAll()


#1

I need to run a function immediately after SourceFile.processAll() runs. How do I accomplish this?


#2

@rbgittins, I know you and the team have already implemented the platform enhancement for this, but for everyone else:

SourceCollection.afterProcess() is a method that allows for triggering some action after all of the chunks of a File have been processed / loaded into the platform.

Example implementation:

fileSourceCollection = FileSourceCollection.make({
      id: "some_id",
      name: "some_name",
      sourceSystem: {
        id: "some_sourceSystem_id"
      },
      afterProcess: {
        language: "javascript",
        implementation: "function f(sc, file) {
            // write some code in javascript here 
           // sc is the SourceCollection
           // file is the file. file.url gives you the location url of the file that is the id of a SourceFile.
        }"
      }
});