Using Quick Base Action to copy file attachment

  • 0
  • 1
  • Question
  • Updated 7 months ago
  • Answered
  • (Edited)
I currently have a Quick Base Action set up that does the following:
 - Creates a new record in a different table when a certain box is checked
 - Copies several fields from the original record to the new record

How can I get this to also copy a file attachment to the new record, whether using Quick Base Actions, Webhooks, Formula fields, or anything else? I cannot seem to find a solution to this exact scenario.
Photo of Chelsea Harmon

Chelsea Harmon

  • 292 Points 250 badge 2x thumb
  • frustrated

Posted 2 years ago

  • 0
  • 1
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 67,348 Points 50k badge 2x thumb
That cannot be done by mere mortals.  You would actually need to engage with a Quick Base Solution provider to do that.

But how about just putting a link on the new record.

The formula for such a link would be

URLRoot() & "up/" & [_DBID_my table name where the file] & "/a/r" & [Record ID# of the record with the file] & "/e30/v0"

Change the e30 to exx where xx is the field ID holding the file.
Photo of Chelsea Harmon

Chelsea Harmon

  • 292 Points 250 badge 2x thumb
Appreciate your response to this last month, it worked brilliantly! However, I'm running to a different issue concerning the button links I have created to these URLs.

I have 7 record attachments that "copy over" in this way from one table to another (the links appear as buttons on the new record).

However, not all of these attachment fields will actually have an attachment (usually only 2-3 attachments were actually uploaded). Quickbase is somehow copying URLs for attachments that do not exist and showing the buttons on the new record - how do I prevent this? When you click the link button, it takes you to a page that says the attachment doesn't exist. How can I tell it to not copy this field if it is blank?
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 67,348 Points 50k badge 2x thumb
I suggest that you make a field which is the ToText value of the file name.

Then set a Condition for the Action to fire only when that is not blank.
Photo of Michael Barrow

Michael Barrow

  • 2,216 Points 2k badge 2x thumb
Could also handle this a step before that and just embed the current button code within an IF() function that tests whether or not an attachment exists for that button, and if it doesn't, hide the button so it can't be clicked.
Photo of Chelsea Harmon

Chelsea Harmon

  • 292 Points 250 badge 2x thumb
I'm not sure what you mean the "make a field which is the ToText value of the file name."

Would you mind elaborating?

Right now I have a Formula-URL field which copies the URL of each file attachment. So would I need an additional 7 fields to do what you are talking about or is this something that I would be editing in the current Formula-URL fields?
Photo of Michael Barrow

Michael Barrow

  • 2,216 Points 2k badge 2x thumb
In your formula text field for each button:

If( Length(ToText([File Attachment Field])) = 0, null, <your current button code> )

This will test the attachment to see if it exists, and if it doesn't, the button will not show and therefore cannot be clicked.
Photo of Chelsea Harmon

Chelsea Harmon

  • 292 Points 250 badge 2x thumb
So you are saying I need to create a formula text field that corresponds to each formula URL button?

Or that I am replacing the formula that is currently there with the one above?
Photo of Michael Barrow

Michael Barrow

  • 2,216 Points 2k badge 2x thumb
Replacing the current formulas by wrapping them within the IF function. That will let you control whether or not it is appropriate for the buttons to display at all, based on your criteria that not all attachments necessarily exist.
Photo of Chelsea Harmon

Chelsea Harmon

  • 292 Points 250 badge 2x thumb
Now I'm getting this:

Please check the syntax of your entire formula. Possible culprits are a mismatched set of parentheses, missing quotes, or an extra bracket.


If( Length(ToText([Bid Analysis])) = 0, null,   <URLRoot() & "up/" & Dbid() & "/a/r" & [Req ID#] & "/e81/v0"> )


I put my current formula exactly as it is, but it is appearing in Italic in the error message so I assuming it is trying to tell me that is where the error is?
Photo of Michael Barrow

Michael Barrow

  • 2,216 Points 2k badge 2x thumb
Sorry. Get rid of the beginning < and the ending > that I put in there. They were merely meant as placeholders to frame the text I entered between them.
Photo of Chelsea Harmon

Chelsea Harmon

  • 292 Points 250 badge 2x thumb
Got it working! Sorry you had to spell it out for me so much.

I swear, the longer I try to get something to work the dumber I seem to become.

Thanks so much for your help.
Photo of Michael Barrow

Michael Barrow

  • 2,216 Points 2k badge 2x thumb
Yay for you! You are very welcome. No worries. I think we've all had to go through the learning curve. Programming kind of sucks because one character being off or missing can tank the whole thing. Very frustrating sometimes. Which is one reason why I so appreciate the QB platform, since it helps to minimize the need for code in the first place.
Photo of Stephanie

Stephanie

  • 732 Points 500 badge 2x thumb
Michael,  I believe I am trying to accomplish the same thing however my [File Attachment Field] is on table A and the formula URL field is on Table B.  I don't believe I can include a field from table A in a formula on Table B.
Photo of Stephanie

Stephanie

  • 732 Points 500 badge 2x thumb
Michael,  I believe I am trying to accomplish the same thing however my [File Attachment Field] is on table A and the formula URL field is on Table B.  I don't believe I can include a field from table A in a formula on Table B.
Photo of Michael Barrow

Michael Barrow

  • 2,216 Points 2k badge 2x thumb
Is there a relationship between the two tables? You will need that. Once it's in place, you can create a lookup field to copy the field from one table and make it available in the other.

Photo of Stephanie

Stephanie

  • 732 Points 500 badge 2x thumb
There is however when I tried to create a lookup to the attachment field it wasn't in the list of options.  The name of the File Attachment field is "Attachment 1" and when I select Add Lookup this field isn't shown in the multiple choice drop down.
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 67,348 Points 50k badge 2x thumb
Make the formula field I suggested and look up THAT field.
Photo of Chelsea Harmon

Chelsea Harmon

  • 292 Points 250 badge 2x thumb
I thought I was going to get away with not doing this, but I have rolled out my Quickbase app at my company and not so much.

For some reason I cannot wrap my head around this formula. Am I putting this in as Formula - URL or some other type?
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 67,348 Points 50k badge 2x thumb
This will be a URL formula field.
Photo of Chelsea Harmon

Chelsea Harmon

  • 292 Points 250 badge 2x thumb
Ok so I am confused about the [Record ID# of the record with the file] part of the formula. It would need to copy a different record each time, so this doesn't seem like it would work?

Each record in the destination table would need to have a link to a corresponding record in the original table, but they will be different attachments for every record.

Is this possible? Or is the only way to do this manually in every record?
(Edited)
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 30,074 Points 20k badge 2x thumb
Photo of Jeff

Jeff

  • 186 Points 100 badge 2x thumb
I am trying to access the related record's attachment with Zapier. A URL to the related record's attachment does not let Zapier pull the attachment properly. Any thoughts on how to do this? If I could copy the attachment when creating the new record it would not be a problem.
Photo of Keith

Keith, Champion

  • 1,126 Points 1k badge 2x thumb
Hi Chelsea/Jeff,
  we have a file attachment sweep add-on that will do exactly what you are looking for.  It can sweep the file from a record in one table and either update a record in another table or add a new record into the table. It will also either move into the other table or just copy it if you want it in 2 places.

You can demo it here:  https://juicedtech.quickbase.com/db/bmzi5qjk7

When a new record is added, the sweep process can:
  • Sweep the file and DELETE it from the record
  • Sweep the file and KEEP the original file on the record
Additionally it can be scheduled to run daily/weekly/monthly to sweep records controlled by a Quick Base report.

Keith
(Edited)