Closed SCLStefan closed 7 years ago
The await operator indicates this is an asynchronous operation, ideally, you should wrap this call in a method that implements the async operator, for example:
public async Task<List<UserTaskInfo>> AcquireUserTasksAsync(TaskQuery taskQuery)
{
return await _camunda.UserTasks.Query(taskQuery).List();
}
then you can use this in other asynchronous operations or just call Wait() and/or Result to wait for the operation to complete and extract the value,
Task<List<UserTaskInfo>> task = AcquireUserTasksAsync(someTaskQuery);
task.Wait();
List<UserTaskInfo> list = task.Result;
a word of caution, Wait() and Result can introduce deadlocks depending on how this gets implemented so take extra care when using them.
Hi Samuel,
this didn't work. But I have discovered, when I remove the following two properties from the class TaskQuery (file UserTask -> TaskQuery.cs) results are returned:
/// <summary>
/// Only include tasks which have a candidate group.
/// </summary>
public bool WithCandidateGroups;
/// <summary>
/// Only include tasks which have no candidate group.
/// </summary>
public bool WithoutCandidateGroups;
But I don't know why this is so - I didn't set these props in my code.
WithCandidateGroups and WithoutCandidateGroups are now nullables. It should work as expected.
Hi,
can you please tell me how to query UserTasks. Querying external Tasks works fine, but when I call
List<Camunda.Api.Client.UserTask.UserTaskInfo> allUserTasks = await camunda.UserTasks.Query(taskQuery).List();
no results are returned. What am I doing wrong?
Best regards Stefan