How can you DELETE ALL records in a model using the action frame work?

  • 1
  • Question
  • Updated 4 years ago
  • Answered
  • (Edited)
I would like to DELETE ALL records in a model with a click of a button using the action framework.  My records do not appear in a table. Is this possible?  I physically want to send them to the recycle bin. Thank you!
Photo of Rich Slack

Rich Slack

  • 4,476 Points 4k badge 2x thumb

Posted 4 years ago

  • 1
Photo of Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 18,496 Points 10k badge 2x thumb
I don't write JavaScript because I'm lazy, but I think this could probably be accomplished pretty easily with a JavaScript snippet triggered by the action frame work. You would need a line that selects all rows in the model, a line that marks them for deletion, and a line that saves the model. The following tutorial may help.
Photo of Rich Slack

Rich Slack

  • 4,476 Points 4k badge 2x thumb
Okay, or those with this same question in the future here is what I did. . . With click no code.

  1.  Added a Delete records button that opened a pop up
  2. The pop up says "Are you sure you want to delete all the records?"
  3. Underneath the question I have a table that shows all the rows in that model. 
  4. Using the GLOBAL ACTIONS button on the table I have a "Run Multiple Actions" button.
  5. Since it is a Global Actions item the "Mark Row(s) for deletion marks ALL the rows for deletion
  6. I then save the model 
  7. close the pop up.  
The global Action button shows up above the table an right underneath the question so it is in the perfect spot for them to click the button that says "Yes, delete all records and start over"

No code and it acts like a "Are you Sure you want to delete all records pop up.