Hi community — hoping someone has run into this and found a fix.
I’ve built an email-triggered workflow that ingests attachments into a data source. The workflow is:
Email Received → JavaScript Function → Upload Data Source Document → Query Data Source → Generate Text → Send Email
The JavaScript function fetches the attachment URL and writes the file content to a workflow variable using ai.vars.file_content. That part works perfectly — the variable is populated with the full document text in the debugger.
The Upload Data Source Document step then receives {{file_content}} in the Document field. In the debugger it shows:
• File content resolving correctly (2,971 bytes)
• “Document processing started” with a real document ID
• “Document processing complete”
• “Data source is ready for queries”
Everything looks successful. But when I check the data source in the Explorer panel, the document count never changes. The Query Data Source step immediately following also returns no results from the newly uploaded content.
What I’ve tried:
• Passing {{attachments}} directly — uploads 97 bytes (just the URL string)
• Passing {{attachments[0]}} — syntax not supported in MindStudio variable fields
• Using a Set Variable block to extract the URL — array indexing not supported
• Using a JavaScript function with ai.vars to fetch and set file_content — variable populates correctly but upload doesn’t persist
• Watching the data source in real time during a workflow run — document count never moves
Has anyone successfully uploaded documents to a data source programmatically via a workflow? Is there something specific about how the Document field needs to be formatted?
HI Alex. The draft one isnt working either. The source docs dont increase in number following an email to the draft or to the published agent. Let me know if you hear back from the team. Appreciate the help!
Thanks for checking in. Apologies it’s taking longer than expected. Our engineers are still looking into this and I’ll update you here as soon as I have news.
Sorry for the delay, our engineers are still looking into this.
I tested the Upload Data Source Document block using the draft email address from the Start block, and the upload completed successfully on my end. Since it’s not working the same way for you, could you record your screen while triggering a run via the draft address? Please also refresh the page after the run completes and include that in the recording.