This form expands the first example, letting the case manager update some details and record the update to the case history.
The form design looks like this:
"Site" is no longer a read-only field, so when the form is submitted the form_SITE process variable will be updated with the new value.
So that the original value can be temporarily stored and written to the case notes, a hidden field, PREVIOUSSITE, has been added to the form. This field grabs the current value of the site field as the page loads via its default function:
The script action at the bottom of the page calls addNoteToCase in the Case Management API:
This script creates the note using the value of the hidden PREVIOUSSITE field and the new value of the SITE field. The parameters of the end point call query the site context variables to find the business key of the case and the username of the person making the update (both are required by the API). Optional parameters, like making the note private and the display name of the user have been left out.