When we need to maintain a control or follow-up to a specific procedure at the time of entering, modify some procedure within the database within a form we have the macro sc\_begin\_trans.

The macro sc\_begin\_trans is responsible for carrying out a transaction control procedure within theScriptCase, but it can also be complemented with the sc\_commit\_trans and sc\_rollback macros.

Now, the macro sc\_commit\_trans takes care that once the control process has been carried out, it can be by means of a condition, confirms the transaction, that is, if all the proposed conditions are fulfilled, confirms the transaction, it can be the to insert, modify or delete a record.

Otherwise the macro sc\_rollback\_transque is responsible for canceling the transactions given by the user, for example, when wanting to enter, modify or delete a record, this is responsible for canceling or omitting the procedure.

To show an alert message we will use a JavaScript function that is responsible for displaying the alert message.

Then, in the following example, it is responsible for making a control when registering:

1. Within the onAfterInsert event, it performs a control after entering by means of a condition:

![](https://scriptcase-support.kayako.com/base/media/url/tciidv3qHQKImGua5toRaZnMHbpzcCBm)

![](https://scriptcase-support.kayako.com/base/media/url/V2vqY0PxoKQi2yaG4mZxcmroysGXbvQ4)

2. The changes are saved, and when you save a record with the name Brazil, it does not allow you to store it.