Below the buttons for a record on an editable grid (view) form.
When the record is initially rendered:
And after clicking on the edit button (the one in the middle above):
So in edit mode, the copy button is moved from the right to the center and the undo button is shown on the right. This way it’s very easy to click the copy button by mistake instead of the cancel button.
For a better ux, the undo button should replace the edit button, thus appear in the middle, and the copy button should stay on the right.
E.g.: