This method can be applied to a variable based on a business component type of a Transaction, after executing the Save, Check, Load or Delete methods, in order to evaluate if the operation was successful or not.
It returns True if the operation was successful. Otherwise, it returns False.
Is a -temporary and local- variable defined in a GeneXus object, based on a Business Component type of a Transaction.
Suppose you define the Customer Transaction as Business Component (by setting its Business Component property = True):
CustomerId* (Autonumber property = True)
error('The customer must be 18 years old or more') if CustomerBirthDate.Age()<18;
Accordingly, a Business Component data type of the Customer Transaction is automatically created in the KB and you are able to define in any object, a variable of the new type created. Thus, in any object you define a variable named &customer based on the Customer type.
The following code (defined for example in a Procedure source or inside an Event in a Web Panel) try to insert a customer minor than 18 years:
&Customer.CustomerAddress='18001 Collins Avenue'
&Messages = &customer.GetMessages()
for &oneMessage in &Messages
Variables defined in this object:
- &messagges: Messages data type (collection)
- &onemessage: Messages.message data type (1 element of the messages collection)
When the success method is evaluated, it returns False because the error rule was triggered and the save wasn't successful, so the code included in the else, will be executed.
Error handling in Business Components
Business Components Methods