I’m building a workflow to send data wich is collected in a mobile app via mail.
I’m trying to do this in a workflow as I have to generate the csv file I want to send at first.
The last step is a Retool Email component where I’m trying to use the fx-Attachment.
The giving structure is following:
I tried several ways, as you can see in the pictures:
But none of them worked, I get following error again and again:
{"data":null,"error":{"error":true,"message":"Use File Input component to upload a file and ensure file is uploaded before query is fired.","isRetoolSystemError":false,"queryExecutionMetadata":{"estimatedResponseSizeBytes":147,"resourceTimeTakenMs":97,"isPreview":false,"resourceType":"retoolEmail","lastReceivedFromResourceAt":1726203840907},"data":{}}}
Am I missing something? Is there any other way?
This is the relevant part of my workflow:
sorry but I didn't realise my account was still on hold.
I already managed to solve this problem with following way.
I added an script block wich combines the data in the right format, the output of the script I then put as the Attachment.
Wanted to add this for anyone who's doing this in the future. This was the code block I used to convert the results of a query block into a base 64 format:
const dataAsCSV = queryBlockName.data
let parsedCSV = Papa.unparse(dataAsCSV)
let b64Data = btoa(parsedCSV)
let attachment = [{ data: b64Data, name: 'filename.csv', contentType: 'text/csv'}]
return attachment
The attachement variable is formatted for an SMTP attachement. Feel free to adjust as needed.