Adding additional parameters to a transaction

In certain scenarios, you may need to modify the parm rule of a specific transaction. This can be achieved using K2BTools, but developers must consider several factors before making such changes.

Before altering the parm rule of a transaction, ensure that your scenario aligns with the following cases:

  • Instantiating a Foreign Key Attribute: If there is a need to instantiate a foreign key attribute, it is preferable to use the method outlined in the How to pre-instantiate a FK value section.
  • Assigning a Default Value to an Attribute: If there is a need to provide a default value to a specific attribute, refer to the method described in Contextual defaults
  • Passing a Tenant Id: It is not advisable to pass the tenant ID as a parameter directly. Instead, employ the strategy outlined in Multi tenant applications with K2BTools

The parameter rule is initially generated in a fixed slot by the K2BEntityServices pattern, which generally restricts developers from modifying it. However, this behavior can be changed. To do so, access the K2BEntityServices Settings in the transaction node and adjust the 'Generate Fixed Slot For Parm' property.

GenerateFixedSlotForParmRule
Filxed Slot for Parm Rule

In this scenario, the parameter rule is not generated in a fixed slot, allowing the developer to modify it as needed. Developers can add as many parameters as necessary, but they must not remove the &Mode variable or any variables related to the attributes of the primary key.

These parameters are automatically included in the parm rule of transaction´s entity manager. Consequently, developers must ensure that in every K2BTools-generated object that calls the transaction or entity manager, both a definition and a value are provided for these additional variables. This is crucial so that the pattern can accurately pass these parameters.In the case of using K2BEntityServices patterns to define a variable, you must add a "Variable" node. Then, utilize the "Events" node to initialize these variables. For more information about events node please read Events nodes in K2BTools Patterns