postSubmit Hook
In the example below, there is a filter on the import that excludes certain records. I was attempting to add a hook inside the import (I used postSubmit) to determine whether the record passed through this import or was skipped. The script simply adds a new object with the value of yes to the responseData and then the response mapping picks up that value and adds it into the source record.
It appears that all records pass through this hook even if they were filtered out at the beginning of the import step because all records are getting the new object = yes added to them. Is this correct and if so, how should I structure the flow such that I can tell whether the record passed through this particular step?
Comments
Michael Gantt that is correct. Hooks run on the entire page of data so that you can easily perform any action against all records. For postSubmit, here is an example of me filtering 1 of 2 records and this is the input of my postSubmit script. You can see that everything is available prior to mapping (in my preMap array), then it gets filtered and the postMap array has the second record as null since it was filtered out. Lastly, in the responseData, you have an ignored boolean field if it was ignored, but no ignored field if it wasn't. The index position of all these arrays align to each other.
Thank you, that helped me get what I needed. In the flow example you sent, how did you get the sample data at the exact spot you wanted (the postSubmit input)?
Michael Gantt in the script, I added console.log(JSON.stringify(options)); as the first line in my function, then I ran the flow, went to the scripts tab on the flow, clicked the 3 dots, clicked view execution log, and clicked refresh.
Perfect, thanks again!
Please sign in to leave a comment.