How to: Add extensibility form to a transaction

This guide explains how to integrate an Extension Form into a Transaction using K2BTools, allowing you to display and manage custom fields defined at runtime.

Step 1: Add an attribute to store the form values

  1. In GeneXus, open your Knowledge Base.

  2. Navigate to the Transaction where you want to add the ExtensionForm.

  3. In the transaction's structure, add a new attribute to store the form data. We recommend using a variable length string type, with a large size.

Step 2: Insert the Extensibility Form Node

AddExtensionFormPattern
Add extension form action

  1. Open the Trn Form instance in the patterns part.

  2. In the instance, locate the node (e.g., a Column, Group, or Section) where you want the Extension Form to appear.

  3. Right-click on the desired node.

  4. Select Add from the context menu.

  5. Choose Extension Form to insert the node into the layout.

Step 3: Configure the Extension Form Node Properties

ExtensionFormNodePatternProperties
Extension form properties

After adding the node, configure the following properties:

  • Name:
    Set the name of the control as it will appear in the web form. This should be unique within the form.

  • Load Strategy:
    If the Extensibility Forms module is installed, set this property to ExtensionForm. This will automatically load the first form associated with the transaction.

  • Save Strategy:
    By default, in transactions, this is set to SerializedInAttribute. This means the data entered in the extension form will be stored as a JSON string in a specified attribute.

  • Serialize In Attribute:
    Select the attribute where the JSON data will be stored. This attribute will contain all the data entered by the user in the extension form. Use the attribute created in the first step in this property.

Step 4: Build the Application

  • Save your changes and build the application.

  • At this point, the extension form area will be empty or not visible, as no forms have been defined yet.

Step 5: Define and Associate a Form at Runtime

  1. Go to the Extensibility Forms module in your application.

  2. Open the Work With interface for forms.

  3. Add a new form:

    • Set the Reference Type to Transaction.

    • Associate it with your transaction by specifying the transaction’s qualified name.

  4. Edit the form as described in How to: Edit extensibility form definition.

Step 6: Test the Integration

  • Open the transaction in the application.

  • The fields defined in your extensibility form will now appear in the UI.

  • Data entered in these fields will be loaded from and stored in the attribute you selected in the Serialize In Attribute property when the transaction is confirmed.

Additional notes

Validation: K2BTools performs standard validations to the data received from the end user. These validations can be seen in Extensibility forms module - Form validation