getFormDrafts Procedure
Plugins can retrieve saved form drafts using the getFormDrafts procedure and restore them using the restore_form_draft mode in the "close" method, enabling mobile workers to resume partially completed forms.
Drafts prevent data loss during interruptions, such as, navigating away mid-entry, which is common in mobile field work. This feature allows plugins to list and restore drafts tied to activities or inventories, improving productivity. The purpose is to support iterative workflows, like multi-step inspections, without losing progress.
For example: A mobile worker starts an Asset Inspection form, enters partial data, and navigates away of the create draft. Later, the plugin calls getFormDrafts:
Response:
getFormDrafts returns a list of saved drafts. Each item has the following structure:
| Name | Type | Description |
|---|---|---|
| draftId | String | Unique identifier of the form draft |
| submittedAt | String | Date and time when the form draft was submitted (in user's format) |
| formLabel | String | Short textual label of the form |
| formTitle | String | Full title of the form (in user's language) as displayed to the user |
| userName | String | Name of the user who submitted the form draft |
| activityId | String | null | Activity ID if a form was submitted for an activity |
| inventoryId | String | null | Inventory ID if a form was submitted for an inventory |
Request:
{
"apiVersion": 1,
"method": "callProcedureResult",
"callId": "83yhtExpHwfo3eOwpOdinQ",
"procedure": "getFormDrafts",
"resultData": [
{
"draftId": "encoded draft id",
"activityId": "8769614",
"inventoryId": "26030118",
"formLabel": "Asset_inspection",
"formTitle": "Asset inspection",
"submittedAt": "09/04/25 10:23",
"userName": "OFSUser"
}
]
}Restore draft when opening formThe restore_form_draft mode is introduced for the "Close" method to restore a draft when opening a form. It allows you to open a form and automatically restore a draft of it previously saved by a user.
| Name | Type | Mandatory | Description |
|---|---|---|---|
| draftId | String | Yes | Unique identifier of the form draft |
| backFormLabel | String | Yes | Short textual label of the form |
| backActivityId | String | No | Specifies the Activity ID for the form page |
| backInventoryId | String | No | Specifies the Inventory ID for the form page |
After retrieving the draft details, the plugin invokes the Plugin API
("close" method), passing the draftId,
activityId, inventoryId, and formLabel.
{
"apiVersion": 1,
"method": "close",
"backScreen": "restore_form_draft",
"backFormLabel": "Asset_inspection",
"backActivityId": "8769614",
"backInventoryId": "26030118",
"backDraftId": "%7B%22p%22%3A%7B%22m%22%3A%22form%22%2C%22label%22%3A%22Asset_inspection%22%2C%22invid%22%3A%2226030118%22%2C%22a%22%3A%22form%22%7D%2C%22uid%22%3A1761%7D"
}