K2BTools Confirm Action Missing Code

Introduction

In K2BTools 10.1 there was a change on the way actions with confirmation are generated.  Prior to K2BTools 10.1 actions with confirmation were generated using a user control. On K2BTools 10.1 the user control is no longer needed, and confirm actions are generated using native GeneXus code.

To use the new implementation for actions with confirmation, all actions must have an event associated with them. This is the case for most actions, however there is one scenario where events are not generated an that happens when the "GXObject" property of the action is empty. Generally, developers use actions without GXObject in order to customize the code of the action adding an Events node. To simplify this, in K2BTools 10.1 EventBeginCode and EventEndCode are enabled for actions without GXObject. when either EventBeginCode or EventEndCode contain user-specified code, K2BTools generates the event associated with the action, and confirm actions will work properly.

Warning message and solution

warning: Action <actionName> has confirm set to true, but has no code associated with it.  You need to set a 'GXObject' to the action or add code to 'Event Begin Code' or 'Event End Code' action properties in order for the confirm action to work

If you get this warning, and wish to add confirmation to the action referenced in the message, you should:

  • If you are migrating from a previous version of K2BTools and have an event node associated with the action (EX: actionname.click), you must copy the events code and place it in either the "Event Begin Code" or "Event End Code" properties of the action. The event node should be deleted after copying the code to avoid duplication.
  • If you are not migrating, use the "Event Begin Code" or "Event End Code" properties in order to implement the action, or set a GXObject to the action.