Events
Events define when something happens on a view or form, such as when someone clicks a button or data is changed. Select the template or event you want to use in your rule definition from the Events tab. Items that are underlined are configured and items that have a dotted line still need configuration.
Templates
Templates contain common events (the when) and actions (the what). You can use these templates to quickly build your rule definition. Use the following tables to learn more about rule events.
Type | Rule Definition | Example |
---|---|---|
View | Execute a method on the View when a control raises an event | When you click a Refresh button you execute the Get List method |
View | Open a subview when a control raises an event | When you click a New button you open a subview |
View | Open a subform when a control raises an event | When you click a New button you open a subform |
View | Navigate to another Form when a control raises an event | When you click a Next button you open a different form |
View | Save the changes of the editable list when a control raises an event | When you click the Save button you save all the changes made to the editable list view |
View | Save the values of a multi-select control when a control raises an event | When you click the Save button you save all the checked or unchecked items |
View | Reload a list control when the View completes an action | After you add a new record, you reload the associated drop down control |
View | Close a subview or subform and execute a method on the View when a subview executes a method | You close a subview or subform after you create a new employee, and then refresh the employee list |
Form | Execute a method on a View when the Form completes an action | After you load a form, you can retrieve a list employees using the Get List method |
Form | Execute a method on a View when a View completes an action | After you create a new employee record, you refresh the employee list view |
Form | Update master and detail values when a control raises an event | When you click the Save button you save all the values that were added, changed or removed |
Form | Navigate to another Form when a View completes an action |
|
Events
Use events to define the when something happens on a view or form to start your rule definition.
Type | Rule Definition | Example |
---|---|---|
Server Events | See Server Rules for a list of server events | |
View Events |
When the view executes one of the following events:
|
|
Control Events |
When the control executes one of the following events:
|
|
Form Events |
When the form raises one of the following events:
|
|
Form Events | When a control on the Form raises an event | When you click a button on a form.
|
View Method | When a view raises one of the following events:
|
|
View Method | When a control on a View raises an event |
When you click a button on a view, or when you change a drop down list item on a view.
|
Subview Events | When a control on a subview raises an event | When you click a button on a dialog.
|
Subview Events | When a subview executes a method | When you create a record on a view on a form in a subform. |
Subview Events | When a subview is closing | When you close a subform |
Subform Events | When a control on a View on a subform raises an event | When you click a Cancel button on a view that you opened in a subform. |
Subform Events | When a control on a subform raises an event | When you click a button on a subform.
|
Subform Events | When a View on a subform executes a method | When you load an employee record.
|
Subform Events | When a subform is closing | When the form that you opened in a subform is closing |
Subform Events | When a subform executes a method | When you create a record on a form that is opened in a subform.
|
Parameter Events | When a View parameter raises an event | When a view parameter is changed. Use the Data Transfer action to change a parameter |
Parameter Events | When a Form parameter raises an event | When a form parameter is changed |
Parameter Events | When a subview parameter raises an event | When a subview parameter is changed |
Parameter Events | When a subform parameter raises an event | When a subform parameter is changed |
Parameter Events | When a View parameter on a subform raises an event | When a view parameter on a subform is changed |
Workflow Events | When the Workflow View is being submitted | Before the workflow action is submitted. Use this event to ensure the form is saved and the worklist item is actioned* |
Workflow Events | When the Workflow View on a View is being submitted | Before the workflow action is submitted on a view. Use this event to ensure the form is saved and the worklist item is actioned* |
Workflow Events |
When the Workflow View on a subview is being submitted |
Before the workflow action is submitted on a subview. Use this event to ensure the form is saved and the worklist item is actioned* |
Workflow Events |
When the Workflow View on a subform is being submitted |
Before the workflow action is submitted on a subform. Use this event to ensure the form is saved and the worklist item is actioned* |
Workflow Events |
When the Workflow View on a View on a subform is being submitted |
Before the workflow action is submitted on a view on a subform. Use this event to ensure the form is saved and the worklist item is actioned* |
Workflow Events | After the workflow action was submitted | After a workflow item is approved. |
Workflow Events | After the workflow action on a View was submitted | After a workflow item on a view is approved. |
Workflow Events |
After the workflow action on a subview was submitted |
After a workflow item on a subview is approved. |
Workflow Events |
After the workflow action on a subform was submitted |
After a workflow item on a subform is approved. |
Workflow Events |
After the workflow action on a View on a subform was submitted |
After a workflow item on a view on a subform is approved. |
*Some conditions, like the current workflow activity being the same as the task actioned, are automatically added during workflow integration.
You can use the following form events with When the Form raises an event:
- In Error - You can execute a rule condition or action when the form is in error, see Configure a Custom Error Rule
- Initialized - You can execute a rule condition or action after the form has loaded, for example expand a view. The Initialized event always executes after the Initializing event regardless if there are user actions configured on Initializing; the Initializing event is disabled, or the Initialized event is called from another rule. See Configure the Initialized Event
- Initializing - You can execute a rule condition or action when the form is loading, for example on a List view, execute the List refresh method. See Configure the Initialized Event for information about the difference in using the Initialized and Initializing events, Configure the Collapse And Expand View Events And Actions for information about using this event with the Collapse and Expand methods, and Configure Tab Navigation To Optimize Performance for information about using tab navigation to improve user experience when a form is loaded (Initializing).
- Submitting - You can execute a rule condition or action when the form is submitting, see How To: Configure Forms with Draft Functionality, Drafts in Android and Building SmartForms for Mobile Devices for more information on saving a form as a draft in the K2 Workspace (Mobile) app before submitting it. When you use drafts in the K2 Workspace (Mobile) app, you must use this rule event with the execute the Submitting Form method action to move the form from the Drafts folder to the Outbox folder when you submit the form. The following images show an example of how you can create these rules:
You can use the following view methods with the When the View raises an event and When the View executes a method events:
- Clear - You can execute a rule condition or action when the view is cleared, for example set the focus to a control, see Configure the Control Focus Actions
- Collapse - You can execute a rule condition or action when the view is collapsed, for example set the focus to another control or tab, see Configure the Control Focus Actions and Configure the Collapse And Expand View Events And Actions
- Expand - You can execute a rule condition or action when the view is expanded, for example on a List view, execute the List refresh method, see Configure the Collapse And Expand View Events And Actions
- In Error - You can execute a rule condition or action when the view is in error, see Configure a Custom Error Rule
- Initialize - You can execute a rule condition or action when the view is loading, for example on a List view, execute the List refresh method
- Initialized - You can execute a rule condition or action after the view has loaded, for example set the focus to a control, see Configure the Control Focus Actions and Configure the Initialized Event for information about the difference in using the Initialized and Initializing events. The Initialized event always executes after the Initialize event regardless if there are user actions configured on Initialize; the Initialize event is disabled, or the Initialized event is called from another rule
The following view methods are available when you use a SmartBox SmartObject on the view or form. If you use another SmartObject, these methods may differ:
- Create - You can execute a rule condition or action when the view executes the Create method, for example on a form, if the Item view executes the Create method, then execute the Get List method on the List view
- Delete - You can execute a rule condition or action when the view executes the Delete method, for example to get confirmation from user
- Load - You can execute a rule condition or action when the view executes the Load method, for example to check for errors using the error handling condition and then show a message with error details, see Configure a Custom Error Rule
- Save - You can execute a rule condition or action when the view executes the Save method, for example on a form, if the Item view executes the Save method, then execute the Get List method on the List view
You can use the following control events with When a control raises an event:
- Clicked - You can execute a rule condition or action when a control is clicked, see How To: Add Lookup Information to a Form for an example.
- Changed - You can execute a rule condition or action when a control is changed, for example when Country Drop-Down list is changed, then populate City Drop-Down list with data. This event executes when the control is set to a new value that is different from the previous value, see How To: Make a SmartObject Call to Populate Controls for an example.
- Initializing - While you can see this event in the Rule Designer, it has been deprecated. Instead use the When the View/Form Initialize event.
You can delete an existing event by clicking on the red cross next to the event or by using the Remove button on the toolbar.
Then navigate to the Events tab to select a new event to complete your rule. Alternatively, you can save the rule if you want to add an event at a later stage. The rule shows as unbound when you filter the rules and is not active until you edit the rule and configure an event.