Toggle menu

renderFormsFromHistoryEvent

Renders previously submitted form(s) using data stored within a history event.

The data stored in the event upon a form submission includes the raw submitted form data, the form name, the form type, and the form definition type (CSFORMDEFINITIONEX or FORMDEFINITIONEX).

For example:

{
    "formData": {
        "formName": "HISTORYWORKERTEST",
        "typeName": "FORM_HISTORYWORKERTEST",
        "formDefinitionType": "FORMDEFINITIONEX",
        "data": {
            "PAGE2.PAGE2FIELD1": "PAGE2_FIELD1_VALUE",
            "PAGE1.PAGE1FIELD2": "PAGE1_FIELD1_VALUE",
            "PAGE2.FILE1": "file/668F5A3A-E4EB-4210-B3CB-59987D38695A/TestDynamicBPMNTwo.bpmn20.xml",
            "FORMACTION.NEXT": "Next",
            "FORMACTION.FINISH": "Submit"
        }
    }
}

This method accepts formData in two ways. Either directly via the formData parameter:

{
    "eventArgs": [{
        "formData": {...As Above...}
    }]
}

Or indirectly by identifying a specific history event from which to extract the formData from:

{
    "eventArgs": [{
        "labela": "TEST",
        "labelb": "HISTORY",
        "labelc": "FORMDATA",
        "pos": 2,
        "renderMode": "readonlynoctrl"
    }]
}

Parameters

NameTypeDescription
apiServerHostURLURL (str enc.), requiredPublicly accessible URL for the API Server, eg http://mysite/apiserver
eventArgsArray, requiredAn array of either formData or label/position objects
   
formDataformDataSee above example of the formData structure.
-or to extract the formData from a history event-
labelaString, requiredHistory label a
labelbString, optionalHistory label b
labelcString, optionalHistory label c
labeldString, optionalHistory label d
labeleString, optionalHistory label e
posInteger, optionalPosition of the event within the history that contains the formData structure to extract
 
rendermodeEnum (string enc.), optionalDefault: "readonlynoctrl". Either "readonly" or "readonlynoctrl"
userContextVarsMapOverride/introduce user context variables that may be read by skeletons, eg {"SITEUSERALIASES": ["ALIAS" ] }
formPropertiesMapOverride form properties, eg EXTPATH/EXTSUPPORT

Checkbox Label Position in iCM

If you are generating a read-only view of a form in iCM using "renderMode": "readonly" (ie from an iCM form app shortcut) you'll find that the labels of single checkboxes appear after the checkbox. This can be worked around by detecting where the form is being rendered and supplying the ISRENDEREDINICM property:

"eventArgs": [{
    "formData": historyFormData,
    "formProperties": {
        "ISRENDEREDINICM": helper.isRenderedInIcm().toString()
    }
}]

Example Requests

formData

{
    "id": 1,
    "method": "renderFormsFromHistoryEvent",
    "params": {
        "apiServerHostURL": "http://mysite/apiserver",
        "eventArgs": [{
            "formData": {
                "formName": "HISTORYWORKERTEST",
                "typeName": "FORM_HISTORYWORKERTEST",
                "formDefinitionType": "FORMDEFINITIONEX",
                "data": {
                    "FORMACTION.FINISH": "Submit",
                    "PAGE2.PAGE2FIELD1": "PAGE2_FIELD1_VALUE",
                    "PAGE2.FILE1": "file/668F5A3A-E4EB-4210-B3CB-59987D38695A/TestDynamicBPMNTwo.bpmn20.xml",
                    "FORMACTION.NEXT": "Next",
                    "PAGE1.PAGE1FIELD2": "PAGE1_FIELD1_VALUE"
                }
            }
        }]
    }
}

Label and Position

{
    "id": 1,
    "method": "renderFormsFromHistoryEvent",
    "params": {
        "apiServerHostURL": "http://mysite/apiserver",
        "eventArgs": [{
            "labela": "TEST",
            "labelb": "HISTORY",
            "labelc": "DATA",
            "pos": 2,
            "renderMode": "readonlynoctrl"
        }]
    }
}

Example Responses

formData

{
    "id": 1,
    "jsonrpc": "2.0",
    "result": {
        "result": {
            "renderedForms": [{
                "headerContent": "",
                "bodyContent": "[...SNIP...]",
                "eventArg": {
                    "labela": null,
                    "labelb": null,
                    "labelc": null,
                    "labeld": null,
                    "labele": null,
                    "pos": 0,
                    "renderMode": "readonlynoctrl",
                    "formData": {
                        "typeName": "FORM_HISTORYWORKERTEST",
                        "formDefinitionType": "FORMDEFINITIONEX",
                        "formName": "HISTORYWORKERTEST"
                    }
                }
            }]
        }
    }
}

Label and Position

{
    "id": 1,
    "jsonrpc": "2.0",
    "result": {
        "result": {
            "renderedForms": [{
                "headerContent": "",
                "bodyContent": "[...SNIP...]",
                "eventArg": {
                    "labela": "TEST",
                    "labelb": "HISTORY",
                    "labelc": "DATA",
                    "labeld": null,
                    "labele": null,
                    "pos": 2,
                    "renderMode": "readonlynoctrl",
                    "formData": null
                }
            }]
        }
    }
}

Last modified on February 27, 2024

Share this page

Facebook icon Twitter icon email icon

Print

print icon