Can we access UserTaskInstance programmatically?

37 views
Skip to first unread message

Pawan Saha

unread,
Mar 14, 2025, 6:26:34 AM3/14/25
to Kogito development mailing list
Hello Team,
Is there any way to access UserTaskInstance programmatically from the code and add a new key (in the below json)?
I cannot inject UserTaskInstance in code. I tried to get access via context, processInstance but could find the relevant method. 
Can you advise?
Screenshot 2025-03-14 155508.jpg

Pere Fernandez

unread,
Mar 14, 2025, 6:39:36 AM3/14/25
to kogito-de...@googlegroups.com, Pawan Saha
@Pawan Saha first of all, what do you mean by adding a new key? If you want to modify the structure of the UserTaskInstance to add a new field that makes sense for your business you 'll have to modify the data-index graphql schema to support it and populate it, which I don't recommend.

Could you please explain a bit what are you trying to achieve?

--
You received this message because you are subscribed to the Google Groups "Kogito development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kogito-developm...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/kogito-development/c2f05a3c-aea6-4836-b17f-e5f2a1519e19n%40googlegroups.com.

pawan saha

unread,
Mar 14, 2025, 7:12:17 AM3/14/25
to Pere Fernandez, Pawan Saha, kogito-de...@googlegroups.com

Hello Pere,

In the attached screenshot (below), you can see we have a service task called "Action Selector". Based on this, the workflow proceeds along specific paths such as "Change Section", "Allocate", and others. These represent the actions being performed.

However, when reviewing the user task history in the Task Console, we only see the User Task states like "Assigned", "In-Progress", and "Analysis". This is because we have only three user tasks defined—Assigned, In-Progress, and Analysis—and actions like "Change Section", "Allocate", and "On-Hold" are executed within the In-Progress task.

Currently, the GraphQL task history API captures and returns only the UserTaskInstances, which is why we only see the main user tasks in the response, not the specific actions taken during those tasks.

What we want to achieve:

We need to capture all actions (e.g., "Change Section", "Allocate", "Return To All Queue", "Kill Review Queue", "On-Hold" etc.) as part of the UserTaskInstance history.

Note: We do not want to introduce new user tasks for each action.

Our goal is to enrich the UserTaskInstance with additional data reflecting these actions, so they are visible when querying task history (e.g., via GraphQL or Task Console).


image.png
Regards,
Pawan
Reply all
Reply to author
Forward
0 new messages