Users of interactions do not need to create interaction pages. This is only of use to workflow and service developers
Within the HTML page you will need access to pmrpc.js which is used for retrieving and sending the data.
Getting the input data
To access the input data for the interaction, you need to call getInputData
getInputData has a field returnValue that has a map from the name of the input port to the data value. So in the above code, retVal.returnValue.myInputPort contains the data that was entered into the port called myInputPort.
This is normally done when the interaction HTML is loaded, for example:
If the data has been published so that it is available as a URL, then you may wish to retrieve the value of the data. This can be done by calling getDataFromUrl
The url is the data value returned from getInputData. The mimetype specifies the mime type to use when getting the data from the URL.
You can send the results of the interaction using reply. reply takes two parameters:
- A status string which should be either
- "OK" or
- A map from the output port name to the value of the output
The above code, returns the string "hello" and the list ["a", "b", "c"] to the ports a_simple_result and a_list_of_results
Cancelling an interaction
The interaction can be cancelled by using reply with a status of "Cancelled". You currently cannot return values if the interaction is cancelled, so the map should be left empty.
Getting the run id
In some interactions it is useful to access the run id that identifies the workflow run that is causing the interaction. This information can be accessed by calling getWorkflowRunId
The workflow run id is returned in retVal.returnValue.
Setting the title of the window
The interaction page can set the title to be used for the window/tab displaying the interaction.
This sets the title of the interaction window or tab to My interesting interaction