Official Content

Gets the collection of errors(*) that occurred after executing the Save, Check, Load or Delete methods.

(*) Those automatically checked by GeneXus as well as the Msg and Error rules defined in the Transaction object.

Syntax

&messages=&VarBasedOnBC.GetMessages()

Where:

&messages
     Is a variable defined in a GeneXus object, based on the Messages structured data type which is automatically defined by GeneXus in every Knowledge Base:

     MessagesSDTImage

  &VarBasedOnBC
      Is a variable defined in a GeneXus object, based on a Business Component.

Samples

Suppose you define the following Transaction as Business Component (by setting its Business Component property = True):

Customer
{
  CustomerId*     (Autonumber property = True)
  CustomerName
  CustomerAddress
  CustomerPhone
  CustomerEmail
  CustomerAddedDate
  CustomerTotalMiles
}

Customer rules:

Default(CustomerAddedDate,&today);
Error("The customer can't be deleted because he has miles to use") if delete and CustomerTotalMiles>0;

Accordingly, a Business Component data type of the Customer Transaction is automatically created in the Knowledge Base and you can define a variable of the new type created in any object. Thus, you can define a variable named &Customer based on the Customer type.

In the same object, the following two variables are also indicated:

&Messages: of the Messages data type, collection
&oneMessage: of the Messages.Message data type, which is 1 element in the collection

Then, specify the following code in the object (for example in Procedure Source):

&Customer.Load(18)
&Customer.Delete()
if &Customer.success()
   commit
else
   &Messages = &customer.GetMessages()
   for &oneMessage in &Messages
       msg(&oneMessage.Description)
   endfor   
endif

See Also

Error handling in Business Components
Business Components Methods







Last update: February 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant