BPM, Workflow, and Case

BPM, Workflow, and Case

Come for answers. Stay for best practices. All we’re missing is you.

 View Only
Expand all | Collapse all

Substitute for tw.system.retrieveTaskList() JS API

  • 1.  Substitute for tw.system.retrieveTaskList() JS API

    Posted Fri April 09, 2021 11:34 AM

    Hello Team,


    Is there a substitute for tw.system.retrieveTaskList() JS API, because this design always enforces current user authorization.

    Requirement is to fetch task list irrespective of current user's authorization. 



    ------------------------------
    Gona Deepak
    ------------------------------


  • 2.  RE: Substitute for tw.system.retrieveTaskList() JS API

    Posted Mon April 12, 2021 08:44 AM
    The TWSearch JSAPI calls should allow you to accomplish this.  In the TWSearch.execute() method, you can specify to either run as a specific user context or as the system - sound like you would want to run this as the system user so you can retrieve ALL tasks matching your criteria.

    JSAPI Reference:
    https://www.ibm.com/docs/en/baw/20.x?topic=apis-javascript-api-in-processes-service-flows#TWSearch

    Example:
    https://www.ibm.com/docs/en/baw/20.x?topic=examples-searching-processes-tasks

    Thanks -Don

    ------------------------------
    Don Williams
    ------------------------------



  • 3.  RE: Substitute for tw.system.retrieveTaskList() JS API

    Posted Mon April 12, 2021 12:54 PM
    Edited by Gona Deepak Mon April 12, 2021 12:55 PM

    Thanks Don William, but I doubt with TWSearch my requirement will be achieved. 

    The requirement is replicate the Team Performance dashboard in tabular format , irrespective of user roles( may be we can say all users).

    The OOTB dashboard restricts it to the managers only, where the tw.system.retrieveTaskList() JSAPI is used.



    ------------------------------
    Gona Deepak
    ------------------------------



  • 4.  RE: Substitute for tw.system.retrieveTaskList() JS API

    Posted Wed April 14, 2021 06:50 PM
    Hi Gona,

    TBH, I don't understand why you say TWSearch can't give you what you're looking for. Your arguments are confusing to me.

    TWSearch can return tasks for any logged in user, not just users in the Managers team.

    Regards,

    ------------------------------
    Thong Huynh
    Sydney NSW
    ------------------------------



  • 5.  RE: Substitute for tw.system.retrieveTaskList() JS API

    Posted Thu April 15, 2021 06:06 AM
    Edited by Gona Deepak Thu April 15, 2021 06:09 AM

    Thank you Thong Huynh for the question .

    Let me try to explain you step by step, hope it will help us to move forward with our discussion. 

    1) We have OOTB JS API tw.system.retrieveTaskList() , for which the input the is taskListProperties BO which has collapsedRiskStates as one of the variable , based on which the task List is returned in form of taskListData BO. So, whatever dashboard /values/ task lists are generation happens it is based on the risk status mainly as  On Track , At Risk , Overdue etc. 

    2) As tw.system.retrieveTaskList() is restricted to manager's group and it also enforces the current user's authorization we cannot achieve the above functionality for all user.

    3) Now, the challenge coming to the designing of the above functionality using  TW Search is that we dont have the option to  bifurcate the task list based on the risk states(On Track, Overdue and At Risk) that are shown Team Performance dashboard.  We can get the list of task based on the team, users , task states but we did not get the option based on the risk state.

    If we try to manipulate the list based on the Due date which is available. Firstly, we may not get the task list count exactly the same as the API returns they are chances of discrepancy. Secondly, if the the number of list count is on higher side there is definitely going to be performance related issues. 

    Any inputs would be of great help, and if any of my understanding mentioned above is wrong , please let me know.



    ------------------------------
    Gona Deepak
    ------------------------------



  • 6.  RE: Substitute for tw.system.retrieveTaskList() JS API

    Posted Thu April 15, 2021 10:34 AM
    Edited by Thong Huynh Thu April 15, 2021 10:36 AM
    Hi Gona,

    Thanks for taking the time to elaborate your problem. So a few things

    1) retrieveTaskList()
    If you are developing a dashboard, forget about retrieveTaskList(). This is a method within ProcessInstance namespace (https://www.ibm.com/docs/en/bpm/8.5.6?topic=designer-javascript-api-reference). What that means is that you have to call this method within a process execution context. Obviously, a dashboard is not within a process context.

    tw.system.currentProcessInstance.retrieveTaskList(properties, maxRows, beginIndex, timezone, checkAuthorization)

    By the way, see the last param to indicate a true or false for checkAuthorization. Also I don't see anything from the docs mentioning that this API is only for Manager users. Did you follow the docs to run this API? Can you show me how you run it and the errors shown?

    2) Get on track, due soon and overdue tasks like in Teams Performance Dashboard
    Yes, I don't know if the Teams Performance Dashboard is using any API to get the on track, due soon, overdue tasks. I don't think it is using any API. Moreover, I think that dashboard is going to be deprecated and replaced by Kibana dashboards in the latest BAW version. Unfortunately, for your custom dashboard, you will have to get the tasks and their due dates and work out the status yourself. 

    Hope this helps
    Regards


    ------------------------------
    Thong Huynh
    Sydney NSW
    ------------------------------



  • 7.  RE: Substitute for tw.system.retrieveTaskList() JS API

    Posted Fri April 16, 2021 03:22 AM

    Hello Thong Huynh,

    This is clarification regarding point 1 of your response  -

    retrieveTaskList API  has scope of current process instance as well as of process application. So,  basically it returns values for tw.system.currentProcessInstance.retrieveTaskList() as well as for tw.system.retrieveTaskList() which is of process app scope.

    For our design we have used the Default Task List Service OOTB available service of Dashboard toolkit, this is the same service which uses tw.system.retrieveTaskList() for fetching the results in taskListData BO. The reason of using this service instead of direct API is because we are implementing in CSHS where this system namespace API is not allowed. 

    Coming to point 2 of the your response - 

    The dashboards uses this particular API to populates it dashboard because the response of the API has the values of At Risk , Overdue, On Track etc. And the behavior of the OOTB dashboard and customized dashboard remains the same compared to the authorization and the reason is of this particular API tw.system.retrieveTaskList() . 

    To view the dashboard - 

    It is not the managers team but the user has to be part of the Instance Owner team which is defined in the overview tab of process to view the dashboard.

    Also where the tagged Instance Owner team should have Manager's Team tagged in team configuration of Manager's Team in manager section of Team tagged. 

    So if Manager's Team is not configured/ tagged in Instance Owner team, then dashboard will not be authorized for viewing.

    Thanks & Regards



    ------------------------------
    Gona Deepak
    ------------------------------



  • 8.  RE: Substitute for tw.system.retrieveTaskList() JS API

    Posted Sun April 18, 2021 09:22 PM
    Hi Gona,

    Thanks again for the response.

    Yes, you're right. I missed that 'retrieveTaskList' also available in this namespace TWBDPSystemNamespace. My apologies. 

    And yes, it seems that this API requires the user to be authenticated and authorised to work with the process instance.

    Is it not possible to map a Team to Instance Owners that is mapped to a LDAP group and have all users included in that LDAP group? I'm sure you have thought about this. Just want to know what is holding you back from doing that?

    Regards.


    ------------------------------
    Thong Huynh
    Sydney NSW
    ------------------------------



  • 9.  RE: Substitute for tw.system.retrieveTaskList() JS API

    Posted Mon April 19, 2021 03:41 AM

    Thank you Thong Huynh for that thought.

    The reason we did not back that approach is because its not the best practice to put all the users in there as per the IBM documentation. 


    Screenshot reference - https://www.ibm.com/docs/en/baw/19.x?topic=process-instance-owners-team



    ------------------------------
    Gona Deepak
    ------------------------------



  • 10.  RE: Substitute for tw.system.retrieveTaskList() JS API

    Posted Mon April 19, 2021 04:01 AM
    Hi Gona,

    Right. Hmm something is still not right here. Looks like 'Instance Owners' are supposed to the people who perform administrative actions on the instances and the tasks, whereas in your case, you're exposing a dashboard to everyone. 

    So the 'retrieveTaskList' JS API was designed only for administrative purposes I suppose. So that looks like a wrong API to use for your scenario then which comes back to you asking originally what would be the alternative. I get the picture now. 

    Yeah so to be honest, I think these are the options I know of:
    - REST API
    - TWSearch (use search column TaskColumns.DueDate)
    - Direct query against LSW_TASKS table (need a DBA to check if your query is optimised)

    Either ones, you still need to work out the on track, due soon and overdue status. 

    Thanks,
    Thong

    ------------------------------
    Thong Huynh
    Sydney NSW
    ------------------------------