
You can use UserDecisionHandler to handle execution of items of types UserDecision . The UWL is shipped with the UserDecisionHandler for WebFlowConnector . Their execution is handled through function modules SAP_WAPI_DECISION_COMPLETE or SAP_DECISION_COMPLETE .
Provider specific Information
UserDecisionHandler is provider agnostic. Items may belong to any connector. For connectors other than the WebFlowConnector a UserDecisionHandler implementation has to be provided.
Supported Actions
Action name can be anything.
Properties
UserDecisionHandler expects the following properties:
UserDecisionTitle (optional)
A caption to be displayed on the user decision page. If not supplied an item subject is used. Can be set only for one of the actions.
UserDecisionNote (optional)
If a note message box to enter a comment is required, then one of the actions should have this property set to true . The note content will be passed back to the connector as the selected action property UserDecisionNoteText . If the note is mandatory for a particular user decision option, then it should be set to mandatory . The validation is done by a connector provider, so make sure the connector provider supports this property.
Other properties are provider specific. For WebFlowConnector , UserDecisionHandler expects the following property:
decisionKey (mandatory)
An internal value (typically a numeric value) corresponding to the selected decision used by the provider. For business workflow item, the list of supported values can be obtained by calling SAP_WAPI_DECISION_READ or SWK_DECISION_READ on a given work item
Configuration for UserDecisionHandler for WebFlowConnectors is done at run time. However, if the decision keys are available for an item type and there is a need to override the default behavior a custom XML configuration can be uploaded.
Following is the definition of an item type for which a user decision webflow workflow with two decisions with keys 1 and 2 is defined:
ItemType name="uwl.task.approval.webflow.TS91100000" connector="WebFlowConnector" defaultView="WorkItemsApprovalView">
<ItemTypeCriteria connector="WebFlowConnector" externalType="TS91100000"/>
<Actions>
<Action name="accept" groupAction="yes" handler="UserDecisionHandler">
<Properties>
<Property name="decisionKey" value="2"/>
<Property name="UserDecisionTitle" value="Approve the request"/>
</Properties>
<Descriptions default="Approve"/>
</Action>
<Action name="reject" groupAction="yes" handler="UserDecisionHandler">
<Properties>
<Property name="decisionKey" value="1"/>
</Properties>
<Descriptions default="Reject"/>
</Action>
</Actions>
</ItemType>
Following is the definition of an item type for which a user decision workflow for the Connector MyConnector with two decisions ( approve_decision , reject_decision ) is defined. MyConnector expects the decision as a selected action property decision. Also, MyConnector expects a text note with the submitted decision.
<ItemType name="uwl.task.approval.my_decision_type" connector="MyConnector" defaultView="WorkItemsApprovalView">
<ItemTypeCriteria connector="MyConnector"/>
<Actions>
<Action name="accept" groupAction="yes" handler="UserDecisionHandler">
<Properties>
<Property name="decision" value="approve_decision"/>
<Property name="UserDecisionNote" value="true"/>
<Property name="UserDecisionTitle" value="Approve the request"/>
</Properties>
<Descriptions default="Approve"/>
</Action>
<Action name="reject" groupAction="yes" handler="UserDecisionHandler">
<Properties>
<Property name="decision" value="reject_decision"/>
</Properties>
<Descriptions default="Reject"/>
</Action>
</Actions>
</ItemType>
The following three features are supported for WebFlowConnector:
The item type can be overwritten with the uwl.task.webflow.decision.TS... name to inherit uwl.task.webflow.decision type. This will force the connector to get the decision alternative descriptions and the decision action title from the back end, avoiding the translation issue, which exists in the first example above. This is the recommended way of overwriting an item type for WebFlowConnector .
Example:
Following is the definition of an item type for which a user decision webflow workflow with two decisions with keys 1 and 2 is defined. Note, that the UserDecisionTitle property and descriptions for actions are not necessary, they will be retrieved at runtime.
<ItemType name="uwl.task.webflow.decision.TS91100000" connector="WebFlowConnector" defaultView="DefaultView">
<ItemTypeCriteria connector="WebFlowConnector" externalType="TS91100000"/>
<Actions>
<Action name="accept" groupAction="yes" handler="UserDecisionHandler">
<Properties>
<Property name="decisionKey" value="2"/>
</Properties>
</Action>
<Action name="reject" groupAction="yes" handler="UserDecisionHandler">
<Properties>
<Property name="decisionKey" value="1"/>
</Properties>
</Action>
</Actions>
</ItemType>
The UserDecisionNote property is supported. The following example will create a memo text box in the preview area of the item. Entering a text in the box and submitting the decision alternative will result in a memo upload to the work item:
<ItemType name="uwl.task.webflow.decision.TS91100000" connector="WebFlowConnector" defaultView="DefaultView">
<ItemTypeCriteria connector="WebFlowConnector" externalType="TS91100000"/>
<Actions>
<Action name="accept" groupAction="yes" handler="UserDecisionHandler">
<Properties>
<Property name="decisionKey" value="2"/>
<Property name="UserDecisionNote" value="true"/>
</Properties>
</Action>
<Action name="reject" groupAction="yes" handler="UserDecisionHandler">
<Properties>
<Property name="decisionKey" value="1"/>
</Properties>
</Action>
</Actions>
</ItemType>
The UserDecisionNote property supports a new flag mandatory , indicating the in order to submit the corresponding user decision option the memo text cannot be empty. The following example will generate a memo text box in the item preview area and force the user to enter a text before submitting a decision alternative corresponding to the decision key 1 .
<ItemType name="uwl.task.webflow.decision.TS91100000" connector="WebFlowConnector" defaultView="DefaultView">
<ItemTypeCriteria connector="WebFlowConnector" externalType="TS91100000"/>
<Actions>
<Action name="accept" groupAction="yes" handler="UserDecisionHandler">
<Properties>
<Property name="decisionKey" value="2"/>
</Properties>
</Action>
<Action name="reject" groupAction="yes" handler="UserDecisionHandler">
<Properties>
<Property name="decisionKey" value="1"/>
<Property name="UserDecisionNote" value="mandatory"/>
</Properties>
</Action>
</Actions>
</ItemType>