Document Intake and Routing
Module 17 · business · intermediate
attach.js
// Put the original upload back on the item (as "data", with the new filename) for the Drive upload.
// Binary data doesn't survive Code/AI nodes on its own, so we read it from the webhook node.
const decision = $input.first().json;
const original = Object.values($('New Document').first().binary ?? {})[0];
return [{ json: decision, binary: { data: { ...original, fileName: decision.filename } } }];