Set Assignee not working

Hi,

Set Assignee does not work for me. This is my code:

Helper helper = new Helper(new Uri(DEFAULT_URL), “demo”, “demo”);
var http = helper.HttpClient(“task/”+ taskID + “/assignee”);
Dictionary<string, object> variables = new Dictionary<string, object>();
variables[“userId”] = “Ralph”;

var request = new CompleteRequest();
request.Variables = Helper.ConvertVariables(variables);
request.BusinessKey = null;

var requestContent = new StringContent(JsonConvert.SerializeObject(request, new JsonSerializerSettings { ContractResolver = new CamelCasePropertyNamesContractResolver() }), Encoding.UTF8, Helper.CONTENT_TYPE_JSON);
var response = http.PostAsync("", requestContent).Result;

Please help.

I have attached the process definition.

testupdatessigneeissue.bpmn (2.7 KB)

Thanks.

Hi,

what is the response of your request?

Greets
Chris

StatusCode: 204, ReasonPhrase: ‘No Content’, Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
{
Date: Fri, 30 Jun 2017 11:33:55 GMT
Server: Apache-Coyote/1.1
}

Hi,

Any update on this issue?

Hi,

you response looks good, so why do you assume that the setting the assignee does not work?
Do you have any error’s in the log?

Greets
Chris

Hi Zeldon,

That’s because when I call the API : GET task/?processInstanceId=" + processID to fetch the task details after setting the assignee, the assignee is still null in the response.

This is my response after setting the assignee is:

[{“id”:“b00d8d90-5fca-11e7-a7ae-7cb0c2695761”,“name”:“test”,“assignee”:null,“created”:“2017-07-03T14:06:19”,“due”:null,“followUp”:null,“delegationState”:null,“description”:null,“executionId”:“b00d8d8d-5fca-11e7-a7ae-7cb0c2695761”,“owner”:null,“parentTaskId”:null,“priority”:50,“processDefinitionId”:“Process_1:1:afa99b9c-5fca-11e7-a7ae-7cb0c2695761”,“processInstanceId”:“b00d8d8d-5fca-11e7-a7ae-7cb0c2695761”,“taskDefinitionKey”:“Task_1v0hfnm”,“caseExecutionId”:null,“caseInstanceId”:null,“caseDefinitionId”:null,“suspended”:false,“formKey”:null,“tenantId”:null}]

I believe your request body has the wrong structure.

Compare

Dictionary variables = new Dictionary();
variables["userId"] = "Ralph";

var request = new CompleteRequest();
request.Variables = Helper.ConvertVariables(variables);
request.BusinessKey = null;

to the example in

https://docs.camunda.org/manual/7.7/reference/rest/task/post-assignee/#request.

Hi Throben,

This is my request:
{“businessKey”:null,“variables”:{“userId”:{“type”:null,“value”:“Ralph”,“valueInfo”:null}},“workerId”:null}

My response:
StatusCode: 204, ReasonPhrase: ‘No Content’, Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
{
Date: Mon, 03 Jul 2017 09:11:03 GMT
Server: Apache-Coyote/1.1
}

Correct. However, the request body should be:

{"userId": "Ralph"}
1 Like