I am trying to get the active tasks of an instance using the below code. There i

I am trying to get the active tasks of an instance using the below code. There is an active task at a process which is nested two levels from the parent process. And the below code is not capturing the active task that I am looking for. How can I get the tasks of a subprocess?

TaskSummary[] tss = (TaskSummary[]) pes.getCurrentTasksForProcess(
                                                  cddProcessId,
                                                  ProcessExecutionService.UNATTENDED_AND_ATTENDED_TASKS, 0,
                                                  Constants.COUNT_ALL, TaskSummary.SORT_BY_ASSIGNED_TIME,
                                                  Constants.SORT_ORDER_DESCENDING).getResults();

OriginalPostID-198760

OriginalPostID-198760

  Discussion posts and replies are publicly visible

Parents
  • @karthikeyans I would suggest you taking a look at 'getTasksWithStatusForProcesses' (https://forum.appian.com/suite/help/16.1/api/com/appiancorp/suiteapi/process/ProcessExecutionService.html#getTasksWithStatusForProcess-java.lang.Long-java.lang.Integer-boolean-int-int-java.lang.Integer-java.lang.Integer-) which gets the Task Summary in a recursive manner, as the function has got 'recursive_' as an argument. If this works for you, you don't need to do following:
    1. Getting the synchronous and asynchronous subprocesses.
    2. Iterating through the results obtained from above mentioned step to get the Task Summary.


    If the above mentioned procedure doesn't work for you, you may do as follows:

    1. Get the synchronous and asynchronous subprocesses. (This results in getting all the subprocesses at any level for a given process.)
    For doing so, you can take a look at API functions namely 'getSynchronousSubProcessesForProcess' and 'getAsynchronousSubProcessesForProcess'. You can even take a look at the code of the 'Get All Synchronous sub-process ids' Shared Component at https://forum.appian.com/suite/tempo/records/type/components/item/i8BCLGOdlMUpdGVqT-RV7oRg74uEGJO5ycfrnwOlwsGCGUoJtFPYvtso82lOyOrLA/view/summary. (Please note that though Shared Component mentions 'Asynchronous', this component returns Synchronous and Asynchronous information.)

    2. Get the Task Summary from the results obtained above.
    Instead of iterating through the results obtained from above step, you can take a look at 'getTasksWithStatusForProcesses' to obtain the Task Summary with an array of process ids obtained from the above mentioned step. If this doesn't work for you, consider applying 'getCurrentTasksForProcess' in an iterative fashion over the processes obtained in the above mentioned step.

    If you want to get on with the existing and OOTB features rather than building a plugin, you can do so by performing following steps:
    1. Get the synchronous and asynchronous subprocesses for a given process using the plugin 'Get All Synchronous sub-process ids' at https://forum.appian.com/suite/tempo/records/type/components/item/i8BCLGOdlMUpdGVqT-RV7oRg74uEGJO5ycfrnwOlwsGCGUoJtFPYvtso82lOyOrLA/view/summary. The output of this plugin is an array of subprocess ids at any level for a given process.
    2. Using the process ids obtained in the above mentioned step, get the tasks information by querying the analytics. (getportalreportdatasubset() before 7.8 and a!queryProcessAnalytics() from and above 7.8)
Reply
  • @karthikeyans I would suggest you taking a look at 'getTasksWithStatusForProcesses' (https://forum.appian.com/suite/help/16.1/api/com/appiancorp/suiteapi/process/ProcessExecutionService.html#getTasksWithStatusForProcess-java.lang.Long-java.lang.Integer-boolean-int-int-java.lang.Integer-java.lang.Integer-) which gets the Task Summary in a recursive manner, as the function has got 'recursive_' as an argument. If this works for you, you don't need to do following:
    1. Getting the synchronous and asynchronous subprocesses.
    2. Iterating through the results obtained from above mentioned step to get the Task Summary.


    If the above mentioned procedure doesn't work for you, you may do as follows:

    1. Get the synchronous and asynchronous subprocesses. (This results in getting all the subprocesses at any level for a given process.)
    For doing so, you can take a look at API functions namely 'getSynchronousSubProcessesForProcess' and 'getAsynchronousSubProcessesForProcess'. You can even take a look at the code of the 'Get All Synchronous sub-process ids' Shared Component at https://forum.appian.com/suite/tempo/records/type/components/item/i8BCLGOdlMUpdGVqT-RV7oRg74uEGJO5ycfrnwOlwsGCGUoJtFPYvtso82lOyOrLA/view/summary. (Please note that though Shared Component mentions 'Asynchronous', this component returns Synchronous and Asynchronous information.)

    2. Get the Task Summary from the results obtained above.
    Instead of iterating through the results obtained from above step, you can take a look at 'getTasksWithStatusForProcesses' to obtain the Task Summary with an array of process ids obtained from the above mentioned step. If this doesn't work for you, consider applying 'getCurrentTasksForProcess' in an iterative fashion over the processes obtained in the above mentioned step.

    If you want to get on with the existing and OOTB features rather than building a plugin, you can do so by performing following steps:
    1. Get the synchronous and asynchronous subprocesses for a given process using the plugin 'Get All Synchronous sub-process ids' at https://forum.appian.com/suite/tempo/records/type/components/item/i8BCLGOdlMUpdGVqT-RV7oRg74uEGJO5ycfrnwOlwsGCGUoJtFPYvtso82lOyOrLA/view/summary. The output of this plugin is an array of subprocess ids at any level for a given process.
    2. Using the process ids obtained in the above mentioned step, get the tasks information by querying the analytics. (getportalreportdatasubset() before 7.8 and a!queryProcessAnalytics() from and above 7.8)
Children
No Data