HowTo: Using the Cancel Method from Actions for Smart Devices

Official Content
This documentation is valid for:

Many times when you are creating a register of a Transaction object, you need to check some restrictions before saving it. Call another transaction, call a Panel object, a Procedure object, return to the List node, etc. So using the cancel action allows you to add more behaviour to your application, when complex constraints determine whether a record should be saved or not.

The Cancel method can also be used on any Smart Device Object. The behaviour outside the insertion of a record on a WWSD should be: a. Cancel the execution of the Composite block, and return to the caller screen.

In this article we will do one simple example of the previously mentioned. We want to create our own simple cancel button.

We are going to use the following transaction with the work with smart devices pattern applied as used on save method:


As seen on the SmartDevicesApi folder, the Cancel method doesn’t expect any parameter:


The behaviour we want this example to have is to cancel a transaction insertion when our button is pressed.

We will start doing a new Action called "MyCancel".


By double-clicking over the new Action (button MyCancel) it will take us to the event associated.

Event 'MyCancel'

Add the new cancel action to the Application Bar on the Edit mode in Section General with priority set to High.

CancelMethodActionMyCancelLayoutActionBar SD - Priority action property to High value