Resuming a user task on a selected page
Resuming the multi-screen user task form on the page indicated by the input parameter mapping service.
When the user interrupts filling out a user task form (UserTask), the platform saves a form draft. When returning to the task, the form is restored from the draft: the data entered before the interruption returns to its fields, and the form opens on the first visible page.
If the form has attached an input parameter mapping service, the resumed task can open on the page indicated by this service. This lets you handle a process that requires several screens with a single multi-screen user task instead of splitting it into many single-screen tasks.
You add input parameter mapping services in the form properties (see Form properties). When resuming, the mapping service:
receives the data restored from the draft and the draft save date,
indicates the page on which the form should open,
can write values into fields and session variables,
can interrupt the resume and show a business error page.
On which page the resumed form opens
The form has no mapping service or the service did not return a key _recentlyRequestedPageMid
First visible page
The service returned in the key _recentlyRequestedPageMid the page MID that exists in the form
Page indicated by the service
The service returned the MID of a page that does not exist in the form
First visible page (without error message)
The service reported a business error
Business error page instead of the form
When the form opens on the page indicated by the service, pages before it (in the current form page order) are marked as visited, and pages after it are not. The user can return to earlier pages with the Back button and will see the data entered before the interruption on them.
What data returns after resuming
Values from the draft return to fields by field ID, regardless of the page on which the field is located. This also applies to fields on a partially filled page.
After changing the order or number of pages in a new version of the form, values return for fields that still exist. The value of a field removed from the form is lost.
Changing the order of pages does not change their MIDs. The page MID (e.g.
Page3) is assigned by the platform when the page is created and does not change when you move the page elsewhere in the form (see Form steps and pages). If you change a page MID, update the mapping service — the MIDs from the draft in the variablevisitedPageswill no longer point to that page, and a non-existent MID in the key_recentlyRequestedPageMidwill open the form on the first visible page.Session variables are restored from the draft.
Fields and session variables blacklisted in the form properties (section Temporary save, subsection Restoring values) are not restored. More in Parking and unparking requests.
Attaching a mapping service
Create a service
Create a script artifact (ScriptService) with the function callService. You can find a description of creating scripts in Creating and attaching scripts. You can also use the ServiceProxy service as a mapping service.
Add the service to the form
Open the user task form in Designer and go to the Properties.
In the section Input parameter mapping services click Add service and select the service.
Map the service input parameters to the form fields and session variables (e.g. parameter
finishTimeto session variablefinishTime).Save the form.
The section lets you add multiple services, change their mapping and order, and remove a service. All these changes are saved in the form.
Mapping service behavior
When the service is called
The platform calls input parameter mapping services once, during the first preparation of the form — before input services. This happens for every form: a new one, one restored from a user task draft, and an unparked one. So the service is also called when entering a task for the first time, when there is no draft yet — then the variable finishTime is empty.
Input data
The service input parameters are mapped the same way as in any form service, from fields and session variables restored from the draft. When resuming, the following variables are useful:
finishTime
Draft save date as the number of milliseconds since January 1, 1970 (e.g. 1792483200000). Empty when the form is run for the first time.
visitedPages
MIDs of pages visited before the interruption, separated by commas, in the order of visits. MIDs may repeat if the user returned to earlier pages (e.g. Page1,Page2,Page1,Page2,Page3). The last element is the page the user saw last.
Service result
The service returns a list with one map. Map keys:
_recentlyRequestedPageMid
MID of the page on which the form should open.
Field ID
Value to enter in the field.
Session variable ID
Value to enter in the session variable.
Example service result that opens the form on the page Page3, enters a value into field branch and into session variable browser:
Entering values into fields and session variables
Values restored from the draft are frozen. A frozen value is protected from being overwritten: services, listeners, data source from another field, or the mapping service do not change it. This ensures that data entered by the user before the interruption is not silently replaced when resuming. When values are unfrozen is described in section Freezing and unfreezing values.
Whether a value from the service result goes into a field or session variable depends on what the draft restored:
The field or session variable has a value from the draft (different from the default one)
The service value is ignored. The draft value remains.
The field has no draft value, and the service returns a value different from the field's default value
The field takes the service value. That value is also frozen.
The field has no draft value, and the service returns a value equal to the field's default value
Nothing changes.
The session variable has no draft value
The variable takes the service value. This value is not frozen, so services, listeners, and data from another field can change it later.
For example, the service returns branch = Warsaw Center. If before the interruption the user selected in field branch value Krakow Market Square, after resuming the field has the value Krakow Market Square. If before the interruption they left the field empty, after resuming the field has the value Warsaw Center.
If the service is to change the value saved in the draft, put this field or session variable on the blacklist in subsection Restoring values. The draft will then not restore the value, and the service can set it.
Business error page
If resuming is not possible (e.g. the offer expired since the draft was saved), the mapping service can report a business error via context.throwBusinessException. The user will see the error page instead of the form. You can find a description of building the error page in Throwing business exceptions.
Example mapping service
The service below:
interrupts resuming when the draft is older than 30 days,
opens the form on the page the user saw last before the interruption,
fills the field
branchwith the customer's default branch if the draft left it empty.
Service input parameters: finishTime, visitedPages, defaultBranch. Output parameters: _recentlyRequestedPageMid, branch.
Freezing and unfreezing values
Values restored from the draft and values entered into fields by the mapping service are frozen: services, listeners, data sources from another field, and the mapping service itself do not overwrite them. Freezing is temporary — it protects draft data until the user enters the page with the given field or changes its value. An unfrozen value behaves like during normal form filling: services, listeners, and data from another field can change it.
When the user enters a page for the first time (including the page on which the form opened), the values of its fields are unfrozen — after the page entry scripts and before the page change triggers. From that moment the page behaves like during normal filling. Session variables on which the page's fields depend are also unfrozen.
Pages marked as visited when resuming (pages before the start page) do not undergo the first entry. Their values remain frozen until the user changes them.
Session variables on which no field on a page visited after resuming depends remain frozen. If the form logic is to change the value of such a variable, add a technical field that listens to this variable (see Unfreezing session variables when unparking).
When resuming, the platform does not revalidate pages before the start page and does not call their services. The services on those pages will run only when the user moves forward through the page.
Validation on submit
Submitting the form validates all pages, including those before the start page that the user did not enter after resuming. A field from an earlier page that is missing or has an invalid value stops submission. The validation message is visible on the page with that field.
Controls with a selectable value list
Between saving the draft and resuming, the value list (domain) of a selection control may change, e.g. the service returns different products or different dates than at the time of interruption. In the 'Phone Number' control, such a list is the list of allowed prefixes, and in the 'Date' control — the list of unavailable days returned by the service. The platform does not check whether the draft value is still on the list and does not inform the user about it. The list of values is reloaded when entering the form and when first entering the page with the control, and each control handles a missing value in its own way:
The selected one is Default value, if it is on the list. Otherwise: when the Display 'Select...' option is enabled — the 'Select...' item, and when disabled — the first item in the list.
Default value, if it is on the list. Otherwise: when the Display 'Select...' option is enabled — an empty value (the required field will fail validation), and when disabled — the identifier of the first item (without a validation error).
The selected one is Default value, if such an option still exists. Otherwise no option is selected.
Default value or empty value (the required field will fail validation).
Selections not present in the new list disappear. Selections that are still on the list remain.
Only values that are on the new list.
No product is selected.
Empty value (the required field will fail validation).
If the draft value is one of the values defined by the properties Minimum slider value displayed, Maximum slider value displayed and Step by which the slider value can be set, the slider is set to the nearest value from the new list (if two are equally close — to the smaller one). Otherwise the slider is set to the first value of the new list.
The value the slider was set to (without validation error).
On the screen, statements not on the new list disappear, and statements that are still on the list remain selected. However, the control value still contains the statements selected before the interruption.
All statements selected before the interruption, even those not on the new list and not visible to the user as selected, unless the user changes the selection.
The control still shows the account selected before the interruption, even though it is not on the new list. When you expand the list, you can see only the accounts from the new list and none is selected.
The account selected before the interruption, unless the user chooses another one. Validation does not report an error, even when the control is required.
The prefix field is empty, and the phone number remains. The control does not set the default prefix, even if it is on the new list.
Nothing, until the user selects a prefix from the new list. Proceeding from the page with the control and submitting the form stop at the prefix validation error (message from property Invalid prefix, default 'Prefix: invalid').
The date from the draft remains in the field, even though it is now an unavailable day.
Nothing, until the user chooses another day. Proceeding from the page with the control and submitting the form stop at the 'Selected date is unavailable' validation error.
The draft value that is still on the list remains selected in all controls.
Examples: value list changed between interruption and resuming
In each example, the service feeding the control returns a different list after resuming than before the interruption, and the mapping service opens the resumed task on the page with that control.
Combobox with card pickup branch selection — before the interruption, the list contained the branches 'Gdansk Wrzeszcz', 'Krakow Market Square' and 'Warsaw Center', and the user selected 'Krakow Market Square'. The branch was closed and after resuming the list contains 'Gdansk Wrzeszcz', 'Poznan Old Market Square' and 'Warsaw Center'. If the control has Default value 'Warsaw Center', after resuming that branch is selected. Without a default value, when the Display 'Select...'option is enabled, the control shows 'Select...', and when disabled — 'Gdansk Wrzeszcz', the first item of the new list.
RadioGroup with card delivery method — before the interruption the user selected the 'Parcel locker' option. The bank withdrew that option and after resuming only the 'Courier' and 'Pickup at branch' options remain. If the control has Default value 'Courier', after resuming that option is selected. Without a default value no option is selected.
CheckboxGroup with additional account services — before the interruption the user checked 'SMS notifications' and 'Card insurance'. The 'Card insurance' option disappeared from the offer, so after resuming only 'SMS notifications' remains checked.
ProductSelector with credit card selection — before the interruption the list contained the 'Classic Card', 'Gold Card' and 'Platinum Card', and the user selected 'Gold Card'. The bank withdrew that card from the offer and after resuming the list contains 'Classic Card' and 'Platinum Card', so no card is selected.
TileGroup with card design selection — before the interruption the user selected the 'Limited Edition' tile. The edition ended and the tile is not on the new list, so after resuming no tile is selected.
Step slider with loan term in months — before the interruption the slider had values '12', '24', '36' and '48', and the user set '24'. After resuming the list contains '12', '20', '30' and '48'. If the slider has properties Minimum slider value displayed 6, Maximum slider value displayed 48 and Step by which the slider value can be set 6, then '24' is one of the values defined by them and the slider points to '20', which is the closest value in the new list. With properties 1, 4 and 1, the value '24' is not among the defined values and the slider points to '12', the first value of the new list.
FedStatements with marketing consents — before the interruption the service returned the statements 'Consent to telephone contact', 'Consent to e-mail contact' and 'Consent to profiling', and the user checked 'Consent to e-mail contact' and 'Consent to profiling'. The bank withdrew 'Consent to profiling' and after resuming the list contains 'Consent to telephone contact' and 'Consent to e-mail contact'. On the screen only 'Consent to e-mail contact' is checked, but if the user submits the form without changing the selection, both consents checked before the interruption will be submitted, including 'Consent to profiling'. If the user checks or unchecks any statement, only the consents checked on the screen will be submitted.
AccountSelector with an installment repayment account — before the interruption the list contained 'Personal Account', 'Savings Account' and 'EUR Foreign Currency Account', and the user selected 'Savings Account'. The account was closed and after resuming the list contains 'Personal Account' and 'EUR Foreign Currency Account'. The control still shows 'Savings Account'. If the user submits the form without changing the selection, that account will be submitted even though it is not on the list.
PhoneInput with country prefixes — before the interruption the prefix list contained '+48', '+420' and '+421', and the user selected '+420' and entered the phone number. The bank stopped supporting Czech numbers and after resuming the list contains '+48' and '+421'. The prefix field is empty, and the phone number remains. Clicking Next shows the message 'Prefix: invalid' until the user selects a prefix from the new list.
DatePicker with branch visit date — the service returns days without available slots as unavailable days. Before the interruption the user selected the day '29.10.2026', which was available. After resuming the service returns the day '29.10.2026' as unavailable. The date remains in the field, and clicking Next shows the message 'Selected date is unavailable' until the user chooses another day.
Handling list changes in the mapping service
Responsibility for handling list changes lies with the mapping service. If the control value may disappear from the list, in the service:
Get the control value from the draft through the service input parameter.
Get the current list of values from the same service that feeds the control (
context.callService).If the value is not on the list, return in the key
_recentlyRequestedPageMidthe MID of the page with the control so that the user can choose the value again.
Example for product selection on page Page2selectedProduct is mapped to the product selection field, and the service OfferedProductsService returns products with the key id id:
Example: resume on the page indicated by the mapping service
The task form has four pages: Page1–Page4. On page Page2 a required field is branch. The mapping service returns _recentlyRequestedPageMid = Page2 and branch = Warsaw Center.
The user fills in the page
Page1and closes the browser tab without entering the pagePage2. The platform saves the draft.The user returns to the task (e.g. from the task list in Eximee Dashboard).
The form opens on the page
Page2. The fieldbranchhas the valueWarsaw Center, because the draft left it blank.After clicking Back the page
Page1shows the data from before the interruption.
If the user had selected in the field before the interruption branch value Krakow Market Square, after resuming the field would have the value Krakow Market Square — the value from the draft is frozen and the mapping service does not overwrite it.
Troubleshooting
The form opens on the first page, even though the mapping service returns _recentlyRequestedPageMid
Check whether the page MID in the service output exists in the form and whether the license covers this functionality.
The form does not open, and there is an error in the logs Duplicate key
At least two mapping services return the same key, e.g. _recentlyRequestedPageMid. Leave this key in the output of only one service.
The mapping service does not change the field value
The field has a value restored from the draft, which is frozen. Add the field to the blacklist in the subsection Restoring values.
Values on the page before the start page are not updated
Pages marked as visited upon resume are not unfrozen, and their services are not called. The values will update when the user moves forward through the page or changes a field value.
The resumed task does not have data entered just before the interruption
The draft is saved after the form session expires. A task reopened before the draft is saved does not yet have the latest data.
Related pages
Last updated
Was this helpful?
