BPM, Workflow, and Case

 View Only
  • 1.  Search in BAW Tasks with filter in task scope not process instance scope using BAW rest exposed services

    Posted Thu November 16, 2023 08:49 AM

    Hello All,
    We developed a project that depends on BAW as a workflow engine and uses an external front-end framework not coaches. and so we use exposed rest services in BAW to start the workflow processes, get tasks of users, and other operations..

    I faced a big issue when searching for tasks using variables mapped to those tasks.
    As if we map the variable (ex:stepNumber)with different values to different activities (ex: stepNumber =1 mapped for userTask1 & stepNumber = 2 for userTask2) and search with that variable using search exposed service : 

    (https://BAW_Server_IP:9443/rest/bpm/wle/v1/search/querycolumns=stepNumber&condition=instanceProcessApp%7CTTS&organization=byTask&run=true&shared=false&filterByCurrentUser=false)
    the response of API depicts two tasks that have the same value of a variable (stepNumber = 2). which means the variable is searched only as global scope for the same process instance and no task scope concept!

    I need your support to solve these issue.



    Assigned and data mapping for userTask1


    Assigned and Data mapping variable for userTask 2:






    ------------------------------
    Mahmoud Abozaid
    ------------------------------


  • 2.  RE: Search in BAW Tasks with filter in task scope not process instance scope using BAW rest exposed services

    Posted Mon November 27, 2023 10:20 AM
    Edited by Robin Rajan Mon November 27, 2023 10:21 AM

    Hi ,
    Step number is process variable and it will be same whenever you perform the search.

    You try following work around if it works.
    1.Have different variables stepNumber1,stepNumber2 to identify the tasks.
    2. Try appending the step number to task name see if you can query based on unique task names.Task Header-->Subject
        eg: Stepname+<#=tw.local.stepNumber#>
    ref:how-customise-step-string



    ------------------------------
    Robin Rajan
    ------------------------------



  • 3.  RE: Search in BAW Tasks with filter in task scope not process instance scope using BAW rest exposed services

    Posted Tue November 28, 2023 04:56 AM

    Hi,
    For the first Workaround 1.Have different variables stepNumber1,stepNumber2 to identify the tasks: my business requirement is to path the same variable with different values. for example if you forward same email to different persons but for first person importance level is very important and for second person normal.

    For the second workaround  Try appending the step number to task name see if you can query based on unique task names
     it will not solve my issue as my original use case is path business object variable (which means the business object has more than one primitive variable) and cannot concatenate business object with task name.

    Thanks for your reply

     



    ------------------------------
    Mahmoud Abozaid
    ------------------------------



  • 4.  RE: Search in BAW Tasks with filter in task scope not process instance scope using BAW rest exposed services

    Posted Mon November 27, 2023 01:56 PM

    It seems you're encountering a challenge with task-specific variable mapping in IBM Business Automation Workflow (BAW) when using REST services for task searches. The issue is that the variable stepNumber is being treated as a global variable for the entire process instance rather than being specific to each task.



    ------------------------------
    ALEXIS Ruben
    Portugal.fr
    ------------------------------



  • 5.  RE: Search in BAW Tasks with filter in task scope not process instance scope using BAW rest exposed services

    Posted Tue November 28, 2023 05:34 AM

    Yes, that is exactly what I mean. and that happened only at search rest API service . but if try to get only one task by get task details service rest API it will ok.
    - the result is ok (stepNumber = 1) for the first task if use task details rest API service (https://{{ip}}:9443/rest/bpm/wle/v1/task/20436?parts=data)

    - the result is ok ((stepNumber = 2))for the othertask if use task details rest API service (https://{{ip}}:9443/rest/bpm/wle/v1/task/20437?parts=data)

    But the result is not correct (stepNumber = 2 for two tasks ) at at search rest service API  

    And My business requirement need to search query rest API because it has some features such as search with criteria i need and also have control size of result which is needed for pagination feature



    ------------------------------
    Mahmoud Abozaid
    ------------------------------



  • 6.  RE: Search in BAW Tasks with filter in task scope not process instance scope using BAW rest exposed services

    Posted Tue November 28, 2023 04:49 PM

    Hi Mahmoud,

    To me, your problem seems to be that you are reading a process variable and expecting to see the value of a task variable. Run Query (or Saved Search) will not show task variables whether they are passed in to the task or not. You have a few options, but none that I can think of that will be as simple as altering your Run Query REST call. Off the top of my head...

    • When the task variable changes, update the instance variable via BAW REST API Update Instance Variable, or JavaScript API TWProcessInstance.businessData. You could even get more complicated and have a complex object that keeps track of which task has which step number instead of having a simple non-list that wouldn't account for multiple active tasks in the process at a time
    • When the query is run for the tasks, run individual calls to look up the task data. This can get expensive depending on how big your queries are, so you could dump the data to a system of record in order to look up this data to supplement your task query. This would require you to persist the task data from within the task when it changes

    Hope this helps



    ------------------------------
    Rex Townsend
    Salient Process
    ------------------------------



  • 7.  RE: Search in BAW Tasks with filter in task scope not process instance scope using BAW rest exposed services

    Posted Fri December 01, 2023 12:36 AM

    Hello Mahmoud,

    We need to understand the business requirement first to provide you a technical solution. 

    As, @Rex Townsend mentioned, that the exposed variable scope is at the process instance level and what @Robin Rajan has mentioned in the first workaround would be the best way handle this technically if you want to stick to the OOTB REST APIs.

    I would slightly update the solution provided by @Rex Townsend, like -

    1. Maintain a SOR table to save the task data
    2. Query the table to get the matching list of task ids
    3. Do a "Bulk Task Details" API call to retrieve the task details, that will have the business data associated with the tasks.

    If you want to try task narratives, you can add complex object in the task narrative which can be queried using Task Query Entity List [deprecated]

    In this case, you can either use "IBM.DEFAULTALLTASKSLIST_75" saved search or create something similar which will have the "taskNarrative" column.

    Please note: If a process instance level variable is directly mapped to the narrative, the narrative for all tasks having the same variable mapping will be updated as soon as the process level variable is updated.

    Thanks!



    ------------------------------
    Atanu Roy
    Lead Engineer
    London Stock Exchange Group
    ------------------------------