API2 : How do I get hold of the workflow task id
Using workflow/groovy code, I want to BULK reassign all task that are currently assigned to one user to another user. e.g .someone goes on vacation or is off sick
I capture all the task by running
tasks = workflowTaskApi.findWorkflowTasks(FindWorkflowTasksRequest.builder().build()).getResults()
I then examine the tasks looking for the specific user(candidateUsers), and get hold of the required tasks. This is all working fine
However, I am not able to locate the task identifier(UUID), so I cannot easily reassign a task using UUID identifier to my new user. (See API snippet below)
Yet, in the REST API this is very simple (See snippet below)
Would be grateful for any advice or code snippets. Were can I find the UUID identifier for the task
Best
Bobby
API Snippet
CP 020 : Task Details are || WorkflowTaskImpl{workflowDefinition=WorkflowDefinitionReferenceImpl{processId=‘bt_approval_Proces’} NamedResourceReference{name=‘null’} ResourceReferenceImpl{id=029f1e2b-90f6-43f0-825d-b0cdbdafc17a, resourceType=null}, workflowInstanceId=1c0967a3-8b33-4b80-9937-3ceaf692106b, key=‘formTask1’, type=‘formtask1’, aggregationKey=‘formOfApproval_bt_approval_Proces:276:d54a8710-5fc1-4048-8291-98f0900975dd’, priority=50, owner=‘[email protected]’, candidateUsers=[User{userName=‘[email protected]’, firstName=‘Robert’, lastName=‘Innes’, emailAddress=‘[email protected]’, gender=UNKNOWN, language=‘en’, additionalEmailAddresses=[], phoneNumbers=[], instantMessagingAccounts=[], websites=[], addresses=[], activated=true, enabled=true, userSource=SSO, guestUser=false, apiUser=false, licenseType=AUTHOR} Resource{createdBy=null, createdOn=1676901489000, lastModifiedBy=00000000-0000-0000-0000-000000900001, lastModifiedOn=1695304181852, system=false, resourceType=User} EntityImpl{id=61d8354a-fd5e-4aa6-8399-069b348b33fb}], createTime=1695299192305, dueDate=1698063992308, cancelable=true, reassignable=true, formRequired=true, formKeyAvailable=true, containsActivityStream=false, inError=false, errorMessage=‘null’, customButtons=[], description=‘Robert Innes proposed a new asset that requested approval’, title=‘Approve or Reject Asset’, businessItem=ResourceReferenceImpl{id=08aa4cc6-7831-476d-9a33-cd5d392a5b1c, resourceType=Asset}’, businessItemReference=NamedResourceReference{name=‘Cars BBT 001 (Bobby Innes)’} ResourceReferenceImpl{id=08aa4cc6-7831-476d-9a33-cd5d392a5b1c, resourceType=Asset}} [authenticated_id=61d8354a-fd5e-4aa6-8399-069b348b33fb, session_hash=f0cff5b240c49e7a6961ee2716803636, trace_id=7c237dda1995a3f95ad37f660274c227, trace_flags=01, span_id=88d74fdcfb75ba60]
Rest API
Response body
Download
{
"total": 1,
"offset": 0,
"limit": 0,
"results": [
{
"id": "fcef4c5b-8d2a-46ba-af16-974b27849cb7", <<===== This is what I am after
"system": false,
"resourceType": "WorkflowTask",
"workflowDefinition": {
"id": "029f1e2b-90f6-43f0-825d-b0cdbdafc17a",
"processId": "bt_approval_Proces"
},
"workflowInstanceId": "1c0967a3-8b33-4b80-9937-3ceaf692106b",
"key": "formTask1",
"type": "formtask1",
"aggregationKey": "formOfApproval_bt_approval_Proces:276:d54a8710-5fc1-4048-8291-98f0900975dd",
"priority": 50,
"owner": "[email protected]",
"candidateUsers": [
stefan_busch
·2 years ago · EditedHi,
you can just call .getId() on the WorkflowTask object.
should look something like this:
for(task in tasks) {
task.getId() //<-- this is the Workflow Task UUID
}