Wednesday, January 30, 2013

Passing custom attributes through Human workflow TaskQuery webservice

In my project there were multiple modules like task Management and Project Module. Each module has human workflow implemented .Customer requirement is to list all the tasks from different modules under a single Manage Tasks page.  So we had to differentiate the different human tasks from each module while listing and fetching details specific to the tasks.  So we had to pass some unique values as part of the payload while the j2ee application queries the TaskService API.
The way to do is to use the flex fields under systemMessageAttributes .
In the assign operation of Human task invocation assign the attributes that need to be passed. Since we pass in the category or module as textAttribute2 the web app will use that to identify which module the id belongs to and fetched details based on the id from corresponding module tables.
Refer table below.


Output values
Human TASKQueryAPI
ID
$initiateTaskInput.payload/task:task/task:systemMessageAttributes/task:textAttribute1
CATEGORY
$initiateTaskInput.payload/task:task/task:systemMessageAttributes/task:textAttribute2
ACTION
$initiateTaskInput.payload/task:task/task:systemMessageAttributes/task:textAttribute3
EXPIRYTIME
$initiateTaskInput.payload/task:task/task:systemMessageAttributes/task:textAttribute4


For Querying the task list and fetching flex fields

Refer sample payload  in table below.
Method:  queryTasks


Input
   <soapenv:Header/>
   <soapenv:Body>
      <tas:taskListRequest>
         <com:workflowContext>
<com:credential>
               <com:login>georgethomas@geo.com</com:login>
               <com:password>welcome1</com:password>
               <com:identityContext>myrealm</com:identityContext>
            </com:credential>
           </com:workflowContext>
         <tas1:taskPredicateQuery startRow="0" endRow="0">
            <tas1:displayColumnList>
                   <tas1:displayColumn>title</tas1:displayColumn>
                   <tas1:displayColumn>state</tas1:displayColumn>
                  <tas1:displayColumn>createdDate</tas1:displayColumn>
                  <tas1:displayColumn>expirationdate</tas1:displayColumn>
                  <tas1:displayColumn>priority</tas1:displayColumn>
                  <tas1:displayColumn>taskNumber</tas1:displayColumn>
                  <tas1:displayColumn>instanceid</tas1:displayColumn>
                   <tas1:displayColumn>textAttribute1</tas1:displayColumn>
                <tas1:displayColumn>textAttribute2</tas1:displayColumn>
                <tas1:displayColumn>textAttribute3</tas1:displayColumn>
                <tas1:displayColumn>textAttribute4</tas1:displayColumn>

              </tas1:displayColumnList>
          <tas1:predicate>             
            <tas1:assignmentFilter>My</tas1:assignmentFilter> 
              <tas1:clause joinOperator="AND" xmlns="http://xmlns.oracle.com/bpel/workflow/taskQuery">
                <tas1:column>state</tas1:column>
                <tas1:operator>eq</tas1:operator>
                <tas1:value>ASSIGNED</tas1:value>
                      </tas1:clause>
          </tas1:predicate>
         </tas1:taskPredicateQuery>
      </tas:taskListRequest>
   </soapenv:Body>
</soapenv:Envelope>




Output
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
   <env:Header/>
   <env:Body>
      <taskListResponse xmlns="http://xmlns.oracle.com/bpel/workflow/taskQueryService">
         <task xmlns="http://xmlns.oracle.com/bpel/workflow/task">
            <title>Approve Project Tasks :Project Name - SOA Suite Full Migration TaskName data</title>
            <priority>3</priority>
            <processInfo/>
            <systemAttributes>
               <assignedDate>2013-01-29T03:54:59-05:00</assignedDate>
               <assigneeUsers>
                  <id>georgethomas@geo.com</id>
                  <type>user</type>
               </assigneeUsers>
               <createdDate>2013-01-29T03:54:59-05:00</createdDate>
               <digitalSignatureRequired>false</digitalSignatureRequired>
               <expirationDate>2013-01-29T03:59:59-05:00</expirationDate>
               <fromUser>
                  <type>user</type>
               </fromUser>
               <numberOfTimesModified>1</numberOfTimesModified>
               <state>ASSIGNED</state>
               <systemActions>
                  <action>VIEW_TASK</action>
                  <displayName>VIEW_TASK</displayName>
               </systemActions>
               <taskId>eb792a23-7b1a-4c95-bda6-897fe8e88c5f</taskId>
               <taskNumber>200070</taskNumber>
               <updatedBy>
                  <id>workflowsystem</id>
                  <type>user</type>
               </updatedBy>
               <updatedDate>2013-01-29T03:54:59-05:00</updatedDate>
               <version>1</version>
               <taskDefinitionId>dev/TaskExecutionApprovalProcess!1.0/PMTaskApproval</taskDefinitionId>
               <workflowPattern>Participant</workflowPattern>
               <participantName>Project Manager Approval</participantName>
               <assignees>
                  <id>georgethomas@geo.com</id>
                  <type>user</type>
               </assignees>
               <isPartialTask>true</isPartialTask>
            </systemAttributes>
         <systemMessageAttributes>
               <textAttribute1> 1234</textAttribute1>
               <textAttribute2>TASK</textAttribute2>
               <textAttribute3>APPROVE,REJECT </textAttribute3>
               <textAttribute4> </textAttribute4>
            </systemMessageAttributes>

            <callback/>
            <sca/>
            <taskDefinitionId>dev/TaskExecutionApprovalProcess!1.0/PMTaskApproval</taskDefinitionId>
            <mdsLabel>soa_c0dc1fb9-f1b7-4e5c-80d2-6520f9eb96d8</mdsLabel>
            <customAttributes/>
         </task>
     
</taskListResponse>
   </env:Body>
</env:Envelope>







No comments: