Forum Discussion

JimHarrison's avatar
JimHarrison
Qrew Champion
11 months ago

Managing Attachments Process

I'm researching my options for managing attachments in an App. The goal is to build an automated process that can locate all file attachments in a table (including revisions) and based upon criteria like age or another field on the record delete the attachment.

Has anyone played with this and have experience to share? 



------------------------------
Jim Harrison
transparency = knowledge + understanding : The Scrum Dudes
------------------------------

2 Replies

  • I haven't done exactly what you are asking, but something very close (just not perfected yet).  I had to do it all via Pipelines, using api or xml calls. 

    What I learned is that if a file attachment field only allows one version, you can create a callable pipeline that uses the Webhooks Channel's Make Request with an Application/xml type. For my callable pipeline, I pass in the table id, record id, and field id. Since this method doesn't require a version #, use can use a regular search from the QB channel that only chooses fields with file attachments and in the for next loop, call the pipeline to remove the file attachment. You just have to hard code in the table and field ids.

    The Called Pipeline parameters: 

    Remove_Specified_File_attachment(tableid,fieldid,recid)

    Here is the call in the Called Pipeline

    For fields that have multiple versions, see this post for how the Callable Pipeline looks: Use Pipeline to Remove an attachment from a field

    For our use case, I created a report that only returns the records I know have versions we have either archived or no longer need AND includes the file attachment field.

     In my pipeline, I use the RESTful API "run a report" (Quickbase API Portal) via a  Fetch JSON request. The cool thing is that if you iterate over the results of this call using the pipeline JSON channel/JSON Objects "Iterate over JSON records", you have access to the versions array for the file attachment field. Hopefully my screenshots will give you some idea of what is going on. I would love to loop over the versions, but instead of spending more time on it, I just decided to let it do one version at a time, knowing eventually they'll all be removed as the pipeline runs over time. 

    Here is the screen shot of finding versions (n43 refers to the field 43 returned in the report, which is my file attachment field):

    I know I'm leaving some things out, but hopefully this is enough to get  you going. It's my first "reply" on the forum, but hopefully helpful as I have been helped by so many others to get what I have above done. 



    ------------------------------
    Jamie Low
    ------------------------------
    • JimHarrison's avatar
      JimHarrison
      Qrew Champion

      Hi Jamie,

      Nice! Excellent write up and it all makes sense from here. I'll post my solution when I get one. Am interested to hear if there are others who have their own solution to this garbage collection process.



      ------------------------------
      Jim Harrison
      transparency = knowledge + understanding : The Scrum Dudes
      ------------------------------