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 macrossc\_commit\_trans and sc\_rollback.

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

Otherwise it is the macro sc\_rollback\_trans that 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.

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

1. Within the AfterInsert event a control is made after entering:

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

2. When executing, we enter a code other than 85:![](https://scriptcase-support.kayako.com/base/media/url/UIVU0T1SG9x51LgOUmgrBRwiibB3p7f6)

![]()

Depending on the condition, if the entered code is not 85, then confirm the transaction with the macro sc\_commit\_trans.

3. Otherwise, we enter a record with code 85:

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

4. Then within our database administrator you can see that the record was not loaded with code 85, that's thanks to the macro sc\_rollback\_trans:

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