3 Messages
•
1.3K Points
List in Groovy and how to pass as parameter
I am trying to create a workflow to bulk approve Workflow Tasks. When I pass List to CompleteWorkflowTasksRequest.setTaskIds method, it errors out.
CompleteWorkflowTasksRequest.setIds requires List<UUID> as parameter.
*********************
import com.collibra.dgc.core.api.dto.workflow.FindWorkflowTasksRequest
import com.collibra.dgc.core.api.dto.PagedResponse
import com.collibra.dgc.core.api.dto.workflow.CompleteWorkflowTasksRequest
//Find All Tasks for a particular User and Asset
def findWorkflowTasksRequest = new FindWorkflowTasksRequest()
findWorkflowTasksRequest.setUserId(string2Uuid(userIdReq))
findWorkflowTasksRequest.setBusinessItemId(assetId)
def tasksReq = workflowTaskApi.findWorkflowTasks(findWorkflowTasksRequest).getResults()
// Put the first Workflow Task ID in List
def tasksList = [tasksReq.get(0).getId()]
// Put the Form prorperties of the Task in a Map
def taskFormPropertiesMap = [:]
taskFormPropertiesMap.put("approve", "true")
taskFormPropertiesMap.put("comment", "Approved")
// Call the CompleteWorkflowTaskRequest and pass the List of Workflow ID and the Map of the Form Properties
def completeWorkflowTasksRequest = CompleteWorkflowTasksRequest.builder()
.setTaskIds(tasksList)
.setTaskFormProperties(taskFormPropertiesMap)
.build()
def completedTaskList = workflowTaskApi.completeWorkflowTasks(completeWorkflowTasksRequest).getResults()
***********
Caused by: groovy.lang.MissingMethodException: No signature of method: com.collibra.dgc.core.api.dto.workflow.CompleteWorkflowTasksRequest$Builder.setTaskIds() is applicable for argument types: (ArrayList) values: [[018e3fc7-933e-7fef-8506-855012e1ff3e]]
Possible solutions: taskIds(java.util.List)
When you create a List in Groovy, it is defaulted to ArrayList. It is an implementing class of java.util.List.
Not sure where I am going wrong. Any pointers will be much appreciated.
Thanks
Accepted Solution
SeanPyle
67 Messages
•
1.6K Points
2 months ago
Hey, just taking a guess here.
Are you using methods for CompleteWorkflowTasksRequests instead of the builder methods?
I think you need to click on the builder and use the methods provided within:
(edited)
1
0