Displaying a Work Item Form

This topic provides an example that shows the sequence of calls a client application should make to display a work item form.

See Progressing a Work Item for more information about opening a work item.

Note: The following step-by-step descriptions correspond to the numbered steps in the diagram. Note that the descriptions are from a web service operation point of view, and provide an example of performing the operations using the web service API (SOAP).

For an example of how to use the Service Connector API (Java) to display a work item, see Rendering a Form for a Work Item .

For an example of how to use the Service Connector API (Java) to display a work item, see Rendering a Form for a Work Item .

When a user opens a work item from the user interface:

Procedure

  1. Call openWorkItem. Use the following items in the baseWorkRequest element to specify form-related inputs to the call:
    • channelId specifies the presentation channel to which the client application is bound. (If channelId is not specified, the default channel will be used.)
    • channelType specifies the type of the channelId.
    • responsePayloadMode specifies the format in which the work item data should be returned. This must be JSON.

      If the work item is associated with a single form (rather than a pageflow), the following items in the workResponse element contain the information needed to render the work item:

    • payloadModel.serializedPayload contains the work item data as a JSON payload.
    • presentation.formIdentifier identifies the JSON form artifact to be used to display the work item data).

      For example:

      <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:api="http://api.wp.n2.tibco.com">
         <soapenv:Header/>
         <soapenv:Body>
            <api:baseWorkRequest>
               <resourceId>A2DF6C05-AECA-4D59-A553-A7D029920D51</resourceId>
               <channelId>openspaceGWTPull_DefaultChannel</channelId>
               <channelType>openspaceChannel</channelType>
               <responsePayloadMode>JSON</responsePayloadMode>
               <workItem id="10" version="-1"></workItem>
      </api:baseWorkRequest>
         </soapenv:Body>
      </soapenv:Envelope>
      <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
         <SOAP-ENV:Header/>
         <SOAP-ENV:Body>
            <workResponse xmlns="http://api.wp.n2.tibco.com">
               <payloadModel payloadMode="JSON" xmlns="">
                  <serializedPayload>{items:[{"$param":"PhoneNumber","$value":["666"],"type":"String","mode":"IN"},{"$param":"UserName","$value":["Martin"],"type":"String","mode":"IN"},{"$param":"Message","$value":["Please call Martin at 666."],"type":"String","mode":"INOUT"}]}</serializedPayload>
               </payloadModel>
               <workTypeDetail pilingLimit="0" typePiled="false" uid="WT__2H9PkMP5EeC3yLAVrheurQ" version="1.0.0.201108111305" xmlns=""/>
               <presentation activityName="Displayeverything" formIdenitifier="1.0.0.201108111305/openspaceGWTPull_DefaultChannel/.default/aphMyPackage/aphWelcomeUsers/Displayeverything/Displayeverything.gwt.json" type="GWT_FORM" version="1.0.0.201108111305" xmlns=""/>
               <workItem id="10" version="1" xmlns=""/>
            </workResponse>
         </SOAP-ENV:Body>
      </SOAP-ENV:Envelope>
  2. Pass the work item data and form details to the Forms Runtime Adapter, which renders the form and handles the user’s interaction with it. (See Rendering a TIBCO Business Studio Form.)

    When the user submits, closes or cancels the form, the Forms Runtime Adapter notifies the client application that this has happened and returns the data from the form.

  3. Call closeWorkItem, cancelWorkItem or completeWorkItem as appropriate.