Forum Stats

  • 3,769,819 Users
  • 2,253,026 Discussions
  • 7,875,216 Comments

Discussions

BPM 12c : update the task payload

User_R0EA7
User_R0EA7 Member Posts: 30 Red Ribbon

hi All,

I have a requirement to update the task payload after the task is approved by a user and before the workflow ends. I tried updating the table WFMESSAGEATTRIBUTE  in soa-infra but could not do

as its a blob column. Please let me know how i can update the task payload.

P.S : payload is of XML type.

Requirement : To update a task payload field "status" with the string value "Approved". This field is referred by UI via task query service to display the task status on UI so updation of this field is necessary.

PFB the sscreenshot of the workflow.Highlighted are the parts which updation needs to be done.

pastedImage_0.png

Thanks,

Amith

Answers

  • Martien van den Akker
    Martien van den Akker Member Posts: 2,776 Bronze Crown
    edited Jun 17, 2019 7:11AM

    You will have to query the task using the TaskQueryService. I always refer to the blog of my appreciate coworker Jan: Confessions of a Software Developer: OBPM 11g And Human Workflow Services

    I think it's best to use that one to query the particular task and try to update it. To query the proper task, you should set one of the textattribute values with an identifiable value. And add that in the query predicates (see step 2).

    Then if you have the complete task document, update the payload part and use the complete task document to update it.

    It is important to first query the complete task and update the elemenets and use the updated task document. If you only deliver the changed elements, the not provided elements are nullified.

    Regards,
    Martien

  • User_R0EA7
    User_R0EA7 Member Posts: 30 Red Ribbon
    edited Jun 18, 2019 12:42AM

    Hi Martien,

    Thanks for the reply.

    In this case, workflow is ending so BPM doesn't have control to update the task.Hence the problem. UpdateTask operation will not work in my case to update the payload as the workflow is ending(highlighted in above screeshot).

    I am left with only option to update in WFMESSAGEATTRIBUTE table in soa-infra schema where this task payload is stored. When the user uses queryTasks then he can see the updated payload.

    Now the challenge is : the XML payload i need to update is stored as  blob. I need to update the blob column.

    Below is the XML payload(reconciliation). Need to update the element status to Approved from Submitted.

    pastedImage_1.png

    Please suggest.

    Thanks,

    Amith

  • Martien van den Akker
    Martien van den Akker Member Posts: 2,776 Bronze Crown
    edited Jun 18, 2019 2:40AM

    Hi,

    I'm not sure I understand. If the BPM flow has ended: why would you update a Human Task? And since you wanting to do it  from within the BPM process, by definition the flow hasn't ended. It's only unsure if the task you want to update is still active.

    Which Task do you want to update? Since the activity is in one of the outgoing flows of the Finance task, that one isn't active anymore. So you might want to update the CSM of the Draft Case task?

    I think it doesn't make sense to update task payloads of non-active tasks. Also, I'm not sure of your requirements and the reasons of wanting to update the task, but you shouldn't consider tasks as a means to persist payload data. If it is because of relevant functional data, you should store that from outside of BPM and fetch it when the task is opened by the end-user (so preferably not even when the task is created).

    Regards,
    Martien

  • User_R0EA7
    User_R0EA7 Member Posts: 30 Red Ribbon
    edited Jun 20, 2019 3:15AM

    Hi Martien,

    My requirement is to update the task payload. Human task will be updated when a decision is taken(Approve/Reject). But once use approves a task, then

    inside task payload status field should be changed to Approved.

    In the workflow, when a task outcome decision is taken, task ends changing(updating) the outcome and state. However, I need to update the human task payload where i am facing the difficulty.

    I need to update the task payload for CSM and Finance task(outlined in red in the first screenshot).

    Thanks,

    Amith

  • Martien van den Akker
    Martien van den Akker Member Posts: 2,776 Bronze Crown
    edited Jun 20, 2019 9:00AM
    But once use approves a task, theninside task payload status field should be changed to Approved.

    Do you mean after the task is approved and therefor completed? In that case: the task is already completed and cannot be updated.

    Updating the task is used for two purposes:

    • to provide the end-user information to base his/her decissions upon.
    • to have BPM notified of choices made by handling the task. In this case the outcome is used to drive the BPM process in a certain direction.

    The task payload is a very different kind of variable then process or project variables. The process/project variables are used within the process to make decissions upon and call services. The task payload is used to communicate with the end-user or the system handling the tasks.

    In your case, if I'm correct, the task is approved by the end-user, and instead of reading the status of the payload, now the system decides that the status have to be set to Approved. Then there's no point in updating the task payload, you should change a processvariable Status. And use that in the flow of your process.

    Regards,
    Martien