Error when updating a multi user picker in code

When I try to update a multi user picker I get an error: “{“errorMessages”:[“Internal server error”],“errors”:{}}”
If I update the summary or a string-type custom field, it works correctly. I think the problem is in the way I’m defining the field, since I can use the code for other types of fields with no problem.

I am using Visual Studio 2015 with C# and Razor.

My code is:

string jsonString = @"{""fields"":{""customfield_10400[0].name"" : ""xyz""}}}";
RetrieveTasks.RetrieveTasks objJira2 = new RetrieveTasks.RetrieveTasks();
objJira2.JiraJson = jsonString;
objJira2.updateJiraIssue(objJira2);

public String updateJiraIssue(object objJira2)
            {
            JiraService.open("PUT", JiraUrl + "rest/api/2/issue/" + JiraUrl2);
            JiraService.setRequestHeader("Content-Type", "application/json");
            JiraService.setRequestHeader("Accept", "application/json");
            JiraService.setRequestHeader("X-Atlassian-Token", "nocheck");
            JiraService.setRequestHeader("Authorization", "Basic " + GetEncodedCredentials());

            try
                {
                JiraService.send(JiraJson);
                }
            catch { }

            String response = JiraService.responseText;
            JiraService.abort();
            return response;
            }
1 Like

This is fixed by using the string:

string jsonString2 = @"{""update"": {""customfield_10400"": [ {""add"": {""name"": " + "" + ApproverArgument + "} }]}}";
2 Likes

Thanks, @measterbrook for coming back and answering your own question. Future visitors will thank you.