Can Flow Designer be Triggered by Import Table Records

MGanon
Tera Guru

We have an automated import that requires extensive normalization of the data through the transform maps. Is it possible to trigger a Flow Designer flow to handle some of the processing when the import first creates records in the import table?

1 ACCEPTED SOLUTION

josh_nerius
ServiceNow Employee
ServiceNow Employee

From any published Flow, Subflow or Action, you can generate a code snippet. 

find_real_file.png

 

Snippet: 

find_real_file.png

This snippet will be pre-configured with whatever inputs the flow/subflow has defined. You can then call this in an onBefore or onAfter transform script. 

In the transform map, create a new Transform Script. 

find_real_file.png

And then use the code snippet as a starting point to call the flow and pass in the import set row. 

find_real_file.png

 

Note: For easier debugging, remove "Quick" from the method name to see the flow execution history in Flow Designer. Only do this for a limited number of records. 

View solution in original post

4 REPLIES 4

josh_nerius
ServiceNow Employee
ServiceNow Employee

Can you share a bit more about what you want the flow to do? 

You have a couple of options here. 

1. If you have access to IntegrationHub Enterprise, and if the data is coming from a REST or SOAP API, you can use a Data Stream action to retrieve the data, and process it directly in a flow. 

2. As of Madrid, all Flows, Subflows and Actions can be called via API. You could build a Subflow that takes an Import Set row as an input, and you can then do whatever processeing you need within the flow. It can either A) returns the transformed data as an output, and you can then use that in the transform map or B) directly insert/update records into other tables. 

You can then call this subflow from an onBefore or onAfter script in the transform map. 

If you do go this route, use the executeSubflowQuick() method to ensure that no reporting/context data is recorded; otherwise, you may overwhelm the platform with flow execution reports. 

I have a flow that performs the actions that I intend but simply creating (importing) a record into the import table does not trigger the flow. My question was simply whether creating a record in an import table could trigger a flow. My experiment did not trigger the flow by importing/creating an import table record, nor by updating it.

The next logical question is should the import table trigger a flow. I believe that answer is probably NO. This leads to your alternative...

How? What is the code in a transform map script to call a subflow?

josh_nerius
ServiceNow Employee
ServiceNow Employee

From any published Flow, Subflow or Action, you can generate a code snippet. 

find_real_file.png

 

Snippet: 

find_real_file.png

This snippet will be pre-configured with whatever inputs the flow/subflow has defined. You can then call this in an onBefore or onAfter transform script. 

In the transform map, create a new Transform Script. 

find_real_file.png

And then use the code snippet as a starting point to call the flow and pass in the import set row. 

find_real_file.png

 

Note: For easier debugging, remove "Quick" from the method name to see the flow execution history in Flow Designer. Only do this for a limited number of records. 

Josh- i'm hoping to use this method to have flow designer submit a service request with the imported data.  That being the case- i'm struggling with what to put in the 'target table' on the transform map itself, since I don't really need the data to go anywhere else but the where the flow sends it.  any help?