Roll back committed changes

Hello, My app needs to have a feature wherein the user makes changes to an object making a request and submitting it and later the admin has the option to deny the request. So, when the admin cancels the request the object should go back to the previous state. How can this be achieved in Mendix?
4 answers

Create a temp object with the same properties as the regular object. If the admin approves it overwrite the the regular object otherwise just delete the temp object. Do note that the status of the object remains the same untill the admin approves. You could create a boolean or something that warns that there is a temp state of the object when doing a search in the regular objects.





If an entity hasn’t been committed you can use the Rollback action.

However, it sounds like the change has already been committed and an admin user is coming in at a later stage. In this case copying the old data to another entity and associating it back to the entity with the new data is one approach. If the admin user declines the change, you can copy the data back from associated entity and delete it. If the admin approves, you can simply delete the associated entity. 

Hope this helps.


Hi Priyanka, 

Slightly changed suggestion from what Ronald has already proposed. 

How about exploiting the Generalization for this. 

  1. 1 Parent entity that has Approved values
  2. 1 child entity has draft values. 
  3. When requester changes something, you change the Draft values and submit it.
  4. When approved the draft values are overwritten to approved values. And probably draft values are cleared.
  5. Why generalization
    1. because both records same Mendix ID.
    2. Clear separation of information for reporting purposes too


Iam not sure if there could other technical glitches while implementing.

EDIT → Additional details on 21st July 2020

Generic task below is my child entity, Task is parent entity, as you can see the parent attributes are available to be modified


I would say add a Status Attribute to the Entity and make sure your App handles obbjects with different status in the right way. Add Approval functionality to the Objects with Status = Draft