Definitely!
- We need a form and pre-fill it with data from the selected row. We can do this by adding a default value to the inputs:
- The query to 'Update a record, or create a new record if it doesn't exist.' The way we'll use it is: If a row is selected, we will update. If a row is not selected, we'll create a new user. How does Retool know this? It's all in the 'Filter by.' We can set it up to find the record to update by the
id
of the selected row. If there is no row selected, it's a new record.
- A button to 'Create a new user.' Basically, all this button does is clear the table's row selection with an event handler (No row selected -> new user, empty form).
Here is an app for you to check these settings:
Update or Create record.json (27.8 KB)