Application and Offline Forms
Several new features were added to enable Application and Offline Forms to be surfaced in the K2 Mobile app. This topic will describe these features and how they appear in K2 smartforms and K2 Mobile.
Offline Forms may not be available in all versions of the K2 Mobile Applications. Please check the documentation for your version of the applicable Mobile Application to verify whether Offline Forms are available on your mobile operating system. For more information on how the Mobile App works, see KB001591: Using the K2 Mobile App.
There are two considerations when designing a Form to take advantage of the new features.
The Form properties added can be used to create Application and Offline Forms for use within K2 Mobile. These properties are available at the Form level, and are under the Advanced section:
- Application Form – Makes the Form available in the Forms folder of the K2 Mobile app. These Forms are downloaded from the server to the device, and allow the end user to capture data or start a process instance from a form, all from their device.
- Offline Availability – Makes the Form available for offline use in the K2 Mobile app. This means that any control’s source that has been marked for data caching will download the data to the app to allow the Form to be filled out even when the K2 Mobile app is offline.
These settings are not dependent on each other, and a Form can have one or both options checked.
Any Form that you want to be displayed in the Forms menu in K2 Mobile, also known as an Application Form, must reside in the System > Application Forms category in K2 Designer. This applies to the Form only; any Views used within the Form can reside in a different category.
Workflow task related Forms are not required to be saved in this location.
Application Forms are Forms that surface in K2 Mobile and would typically be used to capture data, start a workflow or be used for reporting purposes. These Forms are not necessarily workflow task related. They are located in the Forms section of the menu bar as shown below:
You can link to Application Forms from a source external to the K2 Mobile App using deep links. See the deep links section of this topic for more information.
If the Form is displayed with a blue Form Activity (download) icon (shown below), it means that the Form has not been previously downloaded. Click on the Form to download it. Once downloaded, the user is able to open and interact with the Form.
If the Form is displayed with no Form Activity (download) icon, either it has been cached and it will be available, or if the Form is greyed out it has been set to be available online only.
If the Form is displayed with the Form Activity (download) greyed out (shown below), it means that the form is not cached and not available while in Offline mode.
Application Forms can be manually refreshed by dragging the page down.
Logging out of the K2 Mobile App clears the cached (previously downloaded) Forms, this means that all Forms with Offline Availability will need to be downloaded again.
Follow the steps below to create an Application Form using K2 Designer:
- Create a Form.
- Select the System > Application Forms folder in the Category field on the General screen. (You may need to select the show System Objects option to see the folder in K2 Designer.)
- Navigate to the Layout screen.
- Expand the Advanced section of the Form properties.
- Select the Application Form setting.
- Finish the Form.
- The Form can now be accessed from the Forms section on the menu bar of K2 Mobile as shown below.
Offline Forms allow for data caching. These Forms can be accessed and actioned in K2 Mobile while not connected, either by the internet or cellular data. If K2 Mobile is offline and the user submits an Application Form or actions a task, the Form will be moved to the Outbox thereby actioning the item offline. When K2 Mobile is connected again, the Form will automatically be actioned or submitted.
If the Offline Availability Form property is not selected on the Form in K2 Designer, the Form will only be available when the K2 Mobile app is online.
There are several considerations when using Offline Forms in your environment. Some scenarios and controls are not supported for forms in Offline mode. This includes, but may not be limited to:
- Licensing. See the Mobile documentation for more detail.
- Performance. The Offline Availability Form property and the Cache the data setting used in the data source of a list control work together and could impact performance. The following should be noted:
- When selecting the Cache the data setting, data is downloaded when the Form initializes. The Form data that is retrieved during initialization is cached. This means that you have to load all the data you need during initialization by checking the Cache the data check box of the data source. The user is able to work offline with the Form as the data is already downloaded. When adding filters in the data source configuration or in a “populate a list control with data” rule for example, only filtered results will be available offline.
- When the Cache the data setting is not selected, data is not downloaded when the Form initializes and cascading drop down controls and picker controls will not contain any data when used offline. It is therefore important to select the Cache the data setting for all drop down controls and picker controls when designing Forms for offline use.
- The Cache the data setting is only available on the following controls:
- Drop-Down List
- Picker
- If a Form could potentially return large volumes of data, it is advised NOT to use the Offline Availability setting as this could result in slow performance when the Form is initialized. For example if a user manager such as Active Directory contains 3000 users, setting the user picker’s data source to work offline will result in slow performance when the Form initializes.
- All actions must be batched. When using offline Forms, it is important to note that only one call is made to the server. It is therefore required to batch rule actions together, in other words using the “complete the following in a batch” execution type. It is advised to have one action button, and the rule for this button should contain all actions required to be executed when offline, for example SmartObject method actions, workflow related methods that need to be executed etc.
- The "Execute another rule" action cannot be used in a rule created for offline purposes as an additional server call is made for this action.
- Note that the built-in task completion action will only complete the task. If any changes are made to the Form and should be saved, a button should be created to execute all offline actions in a batch. For example, if data is created or edited and should be saved, the SmartObject method actions should be added to this rule. It is further advised to hide the built-in task completion action to reduce the risk of the user using this action instead of the newly created button. The task completion action should then be added to the combined rule for execution with the offline actions.
- Form validation. Any client side validation (such as required fields or regular expression validation patterns) will still function for Offline Forms. Any validation that requires server calls, such as looking up data in a SmartObject, will not function in Offline Forms.
- The K2Api and Runtime site must be available on a server that is publicly exposed for the K2 Mobile App to function.
- If the Runtime site requires a Virtual Private Network (VPN) connection, the device must be connected to the VPN before the Form will be cached offline. Once the Form is cached, the user can open and action the Form without a VPN connection. In this scenario the Form submission will be directed to the Outbox and sync when the VPN reconnects.
- Subviews/subforms are not available offline. Opening a subview or subform through rules will not be available offline.
- The Content control is not available offline.
- Paging is not available offline.
The following scenario is using a workflow related Form as an example. Follow the steps below to create an Offline Form using K2 Designer:
- Edit a Form linked to an existing workflow. The workflow should contain a user task that you can action in K2 Mobile.
- Navigate to the Layout screen.
- Expand the Advanced section of the Form properties
- Select the Offline Availability setting. This setting enables the Form to be available offline while working in K2 Mobile.
- Navigate to the rules screen.
- Ensure the rule that will execute when the Form is offline uses the batch execution mode.
- Finish the Form.
- Start a workflow instance.
- Open the Task List in K2 Mobile.
- If no internet connection is available, the task can still be opened and actioned.
The following is applicable to workflow task related Forms:
- Form Properties - When a workflow task related Form is required for offline use, the Offline Availability setting should be selected.
- Application Form Category - Workflow task related Forms are NOT required to be saved in the System > Application Forms category in K2 Designer. It can be created in any category.
If no internet connection is available or if the App is in Offline Mode, the status is reflected as such in the Task List and a red arrow is displayed indicating that Forms are available offline as shown below. The “Offline Mode” status can be dismissed if required by dragging it to the left, revealing the Search bar. Refresh the task list manually to display the status again.
A deep link is a URI that links to a particular location within the K2 Mobile App. Deep links are used to open specific pages in the K2 Mobile application. Three types of deep links can be set up:
- Link to the Task Detail Card.
- Link to the Task Form.
- Link to the Application Form or to start a workflow.
Deep links can be distributed to users in notification emails set up as a step in a Workflow, or by a normal email, or by SMS, or from a website or any other means a link is usually shared. When the deep link is tapped on a mobile device, the target will be opened. If the K2 Mobile App is not running, it will launch and present the login screen when the deep link is tapped but the App will lose context of the deep link and will not navigate to the deep link location after login. You could then tap the deep link again (while the App is running) to open the particular Task or Form.
Building a deep link
K2 deep links consist of a unique schema 'K2', the public facing K2 server address (the server you log into when using the K2 Mobile App), and the target page (Task or Form.) For example: K2://m1.denallix.com/task/[task serial number]
Target Type | Deep link Example |
---|---|
Task Detail Card | K2://m1.denallix.com/task/[task serial number] |
Task Form | K2://m1.denallix.com/task/[task serial number]/form |
Application Form | K2://m1.denallix.com/form/[Form system name] |
The Application Form deep link uses the Form System Name and not the Form Display Name and the Application Form needs to have the Application Form property selected.
If you build the deep link as part of a customized email notification within a Workflow, you need to manually type in the URI, but can drag in the task serial number (for a Task Detail Card deep link) or the Form system name (for an Application Form) from the context browser if you want to, as seen in the images below.
Task Detail Card and Task Form deep link
Application Form deep link
You may not use spaces in the Form system name as the deep link URI does not support them. You can manually enter the Form system name substituting any spaces with the + character, the K2 Mobile App will correctly interpret this.