I have a wizard that is automatically creating multiple children records in a pop up when a button is clicked. In order to reorder the records correctly I have to save them in this process. If the end user decides not to complete the wizard the records are already created. I have a cancel button that can delete row(s) in the action framework but it does not delete all the rows. Is there someway to delete all the records in a model with one click?
Use the “Remove all rows from Model” Action:
This will remove all the rows from the Model, and does not change any data in the database, so it’s perfect for a wizard where you’re creating new records.
Thanks Zach. I tried this, I am likely doing it wrong. Does this just clear the model of the rows but doesn’t delete them? I need it to delete all the records in the model.
Hi guys, how do you delete all rows from a model?
My Wizard creates and saves multiple records. So if someone decides to abort the wizard or start over they need to click the cancel button and it literally delete all the records in that model.
Intuitively you may ask why are you saving the model. You should just give the option to save or cancel:
The child records are created based on information from parent records. One child record is created for every parent record. The reason I save them is because after saving them I query the model to sort them in numeric order so it matches the paper form they are entering data from. From what I can tell I can only sort the records if they are saved first. If I could sort the records before saving that would be preferred.
Okay, for those with this same question in the future here is what I did. . . With click no code.
- Added a Delete records button that opened a pop up
- The pop up says “Are you sure you want to delete all the records?”
- Underneath the question I have a table that shows all the rows in that model.
- Using the GLOBAL ACTIONS button on the table I have a “Run Multiple Actions” button.
- Since it is a Global Actions item the “Mark Row(s) for deletion” marks ALL the rows for deletion
- I then save the model
- close the pop up.
No code and it acts like a “Are you Sure you want to delete all records pop up.”