Attachment file can not be reached in actions

Hi.

Need

  • Manage bank account statements

Intended solution

  • create account statement records using a form to give some basic information (ex.: bank and account) and upload the csv file to a statements database.
  • use an workflow to get this newly created record, read the csv and create a new record into a movements table for each new row in the file

Issue

  • When I submit the form, the trigger works fine and I get the uploaded file information
  • However, when I try to access this information on an action, it is not available:

Could you please advise?

Hi @jmbenedetto — thanks for sharing your use case, it sounds like a great one!

Just to clarify: was your automation flow intended to read the contents of the uploaded CSV file and then use it to create records in another table (like a movement log)? If so — we’d love to hear how you were planning to do that, since Bika.ai currently doesn’t support parsing attachments directly in automations.

That said, if your current issue is about accessing the uploaded file’s URL in automation — we’ve got a workaround for that: Construct File URL Using a Script.

Bika.ai doesn’t yet support using file URLs directly as variables, but you can extract the file path and construct the full URL like this:

fileURL = "https://s1.bika.ai/" + file_info["path"]

Here’s a real example from our AI Batch Image Recognition template:

fileData = <%= JSON.stringify(_item.cells.fldPmeTR63BaQVDjwc7ILVxM.data) %>
IMAGE_MIME_TYPES = {'image/jpeg', 'image/png', 'image/webp'}

if len(fileData) == 1:
    file_info = fileData[0]
    mime_type = file_info.get("mimeType", "").lower()
    
    if (mime_type in IMAGE_MIME_TYPES):
        fileURL = "https://s1.bika.ai/" + file_info["path"]
    else:
        fileURL = "File is not a supported image format: " + mime_type
else: 
    fileURL = "Expected exactly 1 file, got " + str(len(fileData))

:pushpin: To get this working:

  • Use the Run Script action.
  • Use / to call the file field’s raw value(<%= JSON.stringify(_item.cells.fldPmeTR63BaQVDjwc7ILVxM.data) %>): choose field → attachment → field raw data.

It’s a bit manual for now, but we’re actively working to make this process much smoother in future updates.


Here are a couple of helpful resources you might find useful:

:inbox_tray: Manual Incremental Import Option: :point_right: Import and Export | Bika.ai

:package: Upload Files via API :point_right: How to upload files to Bika and update record via API

Hello, Thea, and thanks for the rapid response.

I had two paths in mind:

  1. using pandas to read the text file and then generate a json output. The output would be iterated over by the loop tool.
  2. using httpx to call bika.ai apis to read the file and do the inserting.

Would this be possible ?

Best regards

@Kelvin , could you please help take a look at this question? Thanks!

Hello @jmbenedetto ! Your ideas are spot-on—I tried them out right after reading.

Here’s what I did:

  1. Made an automation with Run Script, Loop, and Create Record actions
  2. Set up a database to store the converted CSV data
  3. Hit “Run now” to process the file (via URL) and import everything

I’ve put together a template for this.

Check out the template here:

Let me know if this works for you! :smile:

1 Like