I have a script trigger that is to be used for selling rolls of paper. The idea is a card window opens, the user will scan in a roll number, the roll number pulls in the details of the rolls and then the script trigger starts. It prompts the user to verify the details of the roll are accurate then prompts the user to enter the buyer name and then the sales price. A confirmation dialog box then appears with the option to OK the sale or revert and cancel the sale.
What is supposed to happen is if the user presses the OK button, a new record of the sale is created in the sales table and then the roll of paper is removed from inventory. If the user presses the revert button no record of the sale should be created and the script stops so that the roll is not removed from inventory.
What is happening however is if the user presses the revert button, the record in the sales table is still being created and then the script stops with the message stating the sale was cancelled. I am not sure why the record is still being created in the sales table.
What am I missing?