A common situation in B2B integrations: a trading partner sends a single EDI file that contains more than one document type, for example an 850 purchase order and an 860 change order, grouped separately under the same interchange. Your downstream flows are built to handle one document type each, so the file needs to be split before it can be processed.
Here's a pattern that uses Celigo file storage as a staging folder, so the split happens entirely inside integrator.io with no external scripts, middleware or manual handling.
How it works
- Land the file in a staging folder: inbound EDI files are picked up from a staging folder in Celigo file storage rather than going straight to a processing flow. This gives you a controlled place to inspect and reshape the file first.
- Split by transaction set: a pre-save script reads the interchange, identifies each transaction set and groups them by document type. For every group it rebuilds a complete, standards-compliant interchange, with the right envelope headers, trailers and counts, so each output looks exactly like a file the partner could have sent on its own. Anything that isn't EDI passes through untouched.
- Route by document type: flow branching sends each reconstructed document down its own path based on its type, 850s one way, 860s another.
- Write back to type-specific folders: each branch writes its document to a dedicated folder in file storage. Your existing 850 and 860 flows pick up clean, single-type files from there, with no changes needed on their end.
Why stage in file storage
- Everything stays inside integrator.io, with no extra infrastructure to maintain.
- The original file is preserved in the inbound folder for auditing or replay.
- Existing document flows don't need to know the split ever happened.
- It's easy to extend: add a branch for 855s, 856s or any other type, or reuse the same staging approach for other pre-processing like de-duplication or re-enveloping.
I've attached the flow as a starting point along with the script. Adapt the branch rules and folder paths to your setup, and if you hit edge cases (multiple interchanges per file, EDIFACT, etc.) share them here and I'll fold them in.
FileStorage_B2BM.zip (7.0 KB)