Updating a transaction after K2BTools has been applied


When the K2BEntityServices pattern is applied, some modifications are performed on the transaction’s definition. The attribute structure is not modified, but the Rules, Events, and Web Form are modified.

These modifications are necessary to implement several pattern features. Because of this, it is important to be careful when updating the transaction afterwards.

To prevent accidental modifications, K2BTools implements several controls to avoid common errors. If the developer updates the transaction’s definition manually and doesn’t follow the rules imposed by the pattern, the pattern will delete the modifications the next time it is applied. This page explains how the developer may modify the transaction’s definition in a way that will not be overwritten by the pattern.

Note: The pattern may or may not update the transaction after the pattern is applied. This behaviour depends on the “Update Transaction” property. See the “Advanced: “Update Transaction” property” section below to see how it affects each part. The sections below explain the pattern’s behaviour when the “Update Transaction” property is in its default value (Apply ES Style).

Updating the “Structure” part

This part can be modified without taking any precautions, as  the pattern does not update this part.

Updating the “Rules” and “Events” parts

The pattern generates code in both these parts. Because of this, it is important to follow some simple rules to add code in these parts. The rules are based on a “slot” mechanism. Basically, the developer may add code outside the “slots” defined by the pattern.

More details can be found in Code slots in Rules and Events.

Updating the “Web Form” part

IMPORTANT: K2BTools includes the “K2BTrnForm” pattern to modify the transaction’s Web Form. Using this pattern is strongly recommended.

The pattern works by dividing the Web Form part in two areas: The “Data Area” and the “Pattern Area”.

 To update this part manually, the developer must restrict the modifications to the “Data Area”. All modifications done on the “Pattern Part” will be overwritten by the pattern the next time it is applied.

 The “Data Area” definition depends on the Web Form editor that is used: 

  • In the HTML editor (in KB’s that are not using Responsive Web Design): Find the table with Control Name “K2BTableTrnDataAreaContainer”. The “Data Area” is the area inside that table.
  • In the Abstract Editor (in KB’s using Responsive Web Design): Find the table “K2BAbstractTableDataAreaContainer”. The “Data Area” is the area inside that table.

Advanced: “Update Transaction” property

This property, located in the Transaction (Entity Services) node in K2BEntityServices instances may alter the behaviour described in the previous sections.

"Update Transaction" property

Possible values for this property are:

  1. Do not update: In this case, the transaction definition is not altered in any way. Because of this, the transaction can be updated at will by the developer. The developer must be extremely cautious when using this option, as it may break pattern features.
  2. Only rules and events: In this case, the Rules and Events parts are updated as described in the previous sections, while the Web Form is not updated. Because of that, the developer may update the Web Form at will. Modifying the “Pattern Area” may break pattern features, so the developer must be cautious when doing that.
  3. Apply ES Style: This is the behaviour explained in the previous sections.
  4. Create Default: All changes made by the developer are discarded and the transaction is brought to its initial state.