I’m trying to set a user in a custom field of type “user picker” using the Atlassian SDK for C#.
When I try to add the user just like any other field it is set in code but not on Jira. And in another request (for a transition) Jira responds with Field Reviewer is required.
Here is what I’ve tried so far…
<code>JiraUser? user = await issue.Jira.Users.GetMyselfAsync(cancellationToken);
issue[field.Name] = user.AccountId;
</code>
<code>JiraUser? user = await issue.Jira.Users.GetMyselfAsync(cancellationToken);
issue[field.Name] = user.AccountId;
</code>
JiraUser? user = await issue.Jira.Users.GetMyselfAsync(cancellationToken);
issue[field.Name] = user.AccountId;
and
<code>var putFields = new
{
fields = new
{
customfield_10824 = new[]
{
new
{
accountId = user.AccountId
}
}
}
};
await issue.Jira.RestClient.ExecuteRequestAsync(RestSharp.Method.PUT, $"/rest/api/2/issue/{issue.Key}", putFields, cancellationToken);
</code>
<code>var putFields = new
{
fields = new
{
customfield_10824 = new[]
{
new
{
accountId = user.AccountId
}
}
}
};
await issue.Jira.RestClient.ExecuteRequestAsync(RestSharp.Method.PUT, $"/rest/api/2/issue/{issue.Key}", putFields, cancellationToken);
</code>
var putFields = new
{
fields = new
{
customfield_10824 = new[]
{
new
{
accountId = user.AccountId
}
}
}
};
await issue.Jira.RestClient.ExecuteRequestAsync(RestSharp.Method.PUT, $"/rest/api/2/issue/{issue.Key}", putFields, cancellationToken);
and with the CustomFields
<code>issue.CustomFields.AddById(field.Id, user.AccountId);
//issue.CustomFields.Add(field.Name, user.AccountId);
</code>
<code>issue.CustomFields.AddById(field.Id, user.AccountId);
//issue.CustomFields.Add(field.Name, user.AccountId);
</code>
issue.CustomFields.AddById(field.Id, user.AccountId);
//issue.CustomFields.Add(field.Name, user.AccountId);
New contributor
Vanilledelfin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.