Automatically Delete File Attachments Upon Data Change

  • 0
  • 1
  • Question
  • Updated 5 months ago
  • Answered
  • (Edited)
This question is a follow-up to: I was wondering if there was a way to automatically delete file attachments when another field changes. Would I use a webhook? I've never had to use one before. Basically, I have 10 Picture fields, and when the status of a job changes, the pictures are no longer needed, and I would like to get rid of them to minimize my file storage usage. Anyone know how I can automatically delete all those pictures when the status of my job changes?

They mentioned in the last post that to delete attachments you had to use:



In case you need to know:
Status Checkbox Validation: rid=410
Picture #1: rid=6
Picture #2: rid=26
Picture #3: rid=27
Picture #4: rid=28
Picture #5: rid=29
Picture #6: rid=30
Picture #7: rid=31
Picture #8: rid=32
Picture #9: rid=33
Picture #10: rid=34

Photo of Jordan McAlister

Jordan McAlister

  • 1,522 Points 1k badge 2x thumb

Posted 5 months ago

  • 0
  • 1
Yes - your best approach will be to use a Webhook in this instance and have it triggered when your trigger field changes. Your XML request is actually copied in the link you provided, I tweaked it a little to bring it up to today - you would simply expand it for all the fields where I stopped

   <usertoken>usertoken goes here</usertoken>
  <field fid="6" filename="delete"></field>
  <field fid="26" filename="delete"></field>
  <field fid="27" filename="delete"></field>
**<insert the rest of your fields here>**

For more detail - the above is what you would put in the 'Message Body' - as the detail for what you want to do

Your endpoint URL would be the table in which you're doing the edit record, so probably the same table the webhook is in

HTTP Method is POST
Message Format is XML
Your message header would be 

Chayce Duncan | Technical Lead
(720) 739-1406 |
Quandary Knowledge Base
Photo of Jordan McAlister

Jordan McAlister

  • 1,522 Points 1k badge 2x thumb
Thanks! I'll give this a try!