Configure Mode Conditions
Use Mode conditions on views or forms to handle when a person is Offline. Using Mode conditions in rules allow you to create your own business logic and perform actions such as showing a message when someone opens a view or form that is offline. You can also customize a standard message by combining system details with your own text. K2 Workspace (Mobile) is the only app that uses the Offline mode. All other uses of the form, such as opening from the worklist or directly in a browser, execute in Normal mode. This topic explains the methods you can use to create and configure Mode conditions in rules.
Custom message using system error information
The sections below illustrate methods for configuring a Mode condition and using the Mode system value. See the Considerations for more information and other considerations.
Use one of the following modes when you configure Mode conditions:
Mode | Description |
---|---|
Normal | Views and forms have full functionality and require a connection to the server. |
Offline | Views and forms have limited functionality and work without a connection to the server. Do not confuse the Offline mode with the Offline Availability setting in the form's properties. You must set the Offline Availability setting in the form's properties to enable the offline mode conditions to work for the K2 Workspace (Mobile) app. See Offline Availability for more information about this setting and Building SmartForms for Mobile Devices for more information about using SmartForms with the K2 Workspace (Mobile) app. |
Use one of the following conditions in a rule and select a mode such as Normal or Offline.
Conditions
if the View is in a certain mode
if a subview is in a certain mode
if a View on a subform is in a certain mode
if a subform is in a certain mode
if the Form is in a certain mode
if a View on the Form is in a certain mode
Under the line containing the mode, add actions to the rule to respond to the mode of a view or a form. A common action is showing a message to the user when a form is offline. Configure the message by using system values from the Context Browser along with any additional details you may want to add.
The images below are examples of how you can use the Mode system value if a form is Offline.
Follow the steps below to configure the rule shown above.
- Edit the rule you want to add the condition to, select the Conditions tab, click the if the Form is in a certain mode rule condition in the Mode section, and then select the Offline mode.
- Hover over the rule condition and click the icon as shown below to move the statement up.
- Hover over the rule condition and click the icon again to move the statement up and create a new execution block.
- Select the Actions tab, click Show a message in the Notifications section, and then click configure.
- Type Device is in the Title field. Expand the System Values node in the Context Browser and drag Mode into the Title and Heading fields as shown below. Type a message in the Body field and click OK.
- When you open the form the rule checks if the form is in Normal or Offline mode and shows a message if the form is Offline. When you click OK on the message the views on the form load.
Use the if an advanced condition is true condition to check the mode of a view or a form before executing an action by dragging Mode from the System Values of the Context Browser. The images below are examples of how you can configure the Mode system value in an if an advanced condition is true condition.
Follow the steps below to configure the rule shown above.
- Edit the rule you want to add the condition to, select the Conditions tab, click the an advanced condition is true rule condition in the Custom Conditions section, and then click the dotted line to configure the condition.
- Click Add and then specify conditions containing a value on the left, operator, and a value on the right. Expand the System Values node in the Context Browser and drag and drop the Mode value on the left. Select the Equals operator and type offline on the right. See the table below for more information about the Conditions, Expressions and Preview sections. Click OK.
- Equals or Not Equals
- Greater Than or Less Than
- Greater Than Equals or Less Than Equals
- Contains
- Starts With or Ends With
- Is Empty or Is Not Empty
- edit the logical operators by clicking on the down arrow.
- change the order of the conditions by clicking on the down arrow next to the number and select another condition.
- add brackets by clicking on the white spaces between each condition to group conditions as shown in the image above. If you do not apply brackets, the Or and And operators have the same precedence. By applying brackets, you can specify the order of execution.
- Hover over the rule condition and click the icon as shown below to move the statement up.
- Hover over the rule condition and click the icon again to move the statement up and create a new execution block.
- Select the Actions tab, click Show a message in the Notifications section and then click configure.
- Type Device is in the Title field. Expand the System Values node in the Context Browser and drag Mode into the Title and Heading fields as shown below. Type a message in the Body field and click OK.
- When you open the form the rule checks if the device is in Normal or Offline mode and shows a message if the device is Offline. When you click OK on the message the views on the form load.
Feature | Description |
---|---|
Conditions | You can use view and form data with comparison operators such as: |
Expressions | Combines the conditions using logical operators such as And and Or. You can:
|
Preview | Shows the expression in preview mode |
- The Mode is determined by the mobile device's status when you open the form. For example, if the mobile device is offline, the Mode reflects as Offline and views and forms are also Offline. If the mobile device's status changes to offline while capturing data, the information is saved in the Outbox and submitted when the mobile device is online again.
- If a form contains a view and the form is Offline, the view inherits the Offline mode. The same principle applies to subviews and subforms.
- When creating rules with the Offline mode, it is important to note that only client side actions execute when the mobile device is Offline. Server side actions are NOT available while the mobile device is Offline.
- It may be a good idea to perform Offline Mode conditions and actions when the view or form initializes to inform the person opening the form that they are Offline.