Question: how can I, when receiving multiple records through a webhook, send them through the flow one at a time or branch off when one of the records is incorrect?
I have a webhook that is receiving shipment data to send load information to our TMS which comes through a WebHook with multiple records. When a record comes through that is missing data, I want to branch off that bad record.
Originally, instead of a webhook, we were using individual files. In that scenario, if one file had missing data, then it would error and the other files would process successfully.
Now, we're switching to a series of API's due to how the data comes out of the WMS software. For that process, I have one flow that is pulling the data from the WMS (that looks like the below) and then sending parsed contents of the into a webhook process flow.
Since it's coming through a WebHook, I'm not able to break the records up and send them one at a time from what I can tell, but that's what I need it to do. I have all of the flow steps set to “Parse One to Many” but the branch received all of the records at once.
@jackharris this is possible to do, but you'll need a preSavePage script. For other sources, like HTTP and FTP, they have a “path to records” field, which is what you're needing in this case, however webhook sources don't have this field. So in your preSavePage script, you take each record which could be 2, then output 3. Can you send a complete XML sample? Here is a sample script though to give direction:
@jackharris you're preSavePage script on the lookup would be this. Notice it checks for array or object because with XML parsing if it only sent 1 confirmation, then it would parse as an object, but if there are multiple then it parses into an Array of multiple.