i am trying to insert a new record into a table when admin approves someones request in grails. What is the right method to achieve this? When admin approves a request a table get updated with a Boolean isapprove true and on success of this insert records in another table.
Thanks in advance
You should create a service and service method to handle the use case. That method should
isapprovevariable.Creating the service and service method ensures that the above steps are transactional, so if one step fails the database is in a consistent state. Also, it is a nice unit of functionality for testing, so the code will be more maintainable.