Skip to main content
Question

File attachment from request form/table to elsewhere in the app via automation/JS

  • August 6, 2019
  • 0 replies
  • 86 views

We have an app where the workflow starts with a Request Table/Form... information from there is then used to create new rows as needed in two other tables, but do not have a relationship with the Request table.

This so far works great. However one of the fields is a file attachment. Would it be possible to use JS to pull the file attachment, and then upload it to another field/table through the API?

You can I believe - the tricky part is the download. You can use API_EditRecord or API_uploadFile to do the upload - but the download, I believe you have to do a GET to the download URL and play with the contents. 

Try out doing a GET against the download URL format: https://realm/quickbase.com/up/dbid/a/rRID/eFID/v0 - that theoretically would give you the raw Base64 contents to just copy over to your new record. I've only work with the uploads - so I'm not 100% confident with the answer.

Chayce Duncan | Director of Strategic Solutions
(720) 739-1406 | chayceduncan@quandarycg.com
Quandary Knowledge Base

  • Author
  • Registered
  • August 7, 2019
That makes sense... Looks like I would need to do a GET for the download URL... then a GET to get the base64... then POST once I have the payload of base64. That makes sense.

I think I was being greedy in trying to do it all in one original GET... Thanks for the pointer, Chayce.

Forum|alt.badge.img+11
  • Quickbase Staff
  • August 7, 2019
Is there a reason you need to actually move the file? Have you considered just passing a URL and keeping the file in the original spot? It is seamless to the user.

  • Author
  • Registered
  • August 8, 2019
Ok so I'm trying your suggestion Harrison, to at least get it somewhat working.. and I have a really basic problem.

I get the URL of the File attachment, and the plan is to populate that link into a text field on the other table... 

I'm getting the infamous "edit record, 0 error, 0 fields changed" api message.

https://<realm>.quickbase.com /db/<dbid>?a= API_EditRecord &rid=1& fid_39_=https:// <realm>.quickbase.com /up/ <dbid> /g/rb/ebg /va/TestInvoice12345.pdf

I'm sure I'm missing something obvious.

**Added spaces in the API URL so you can read it all**

  • Author
  • Registered
  • August 8, 2019
Figured it out... I forgot the leading underscore for _fid_39_