Error "customfield_10XXX... operation must be string" or "The Team must be a string" on Jira Align Connector
Summary
After creating or updating a Story associated with a Team, the error "Failed to update JiraID : {id} - Response: 400 BadRequest Json: {"errorMessages":[],"errors":{"customfield_10XXX":"operation must be string"}}'" appears on the Audit Logs and the sync Jira Align to Jira does not work anymore.
Environment
Jira Align
Diagnosis
When you look at the work item (i.e story) audit log you see:
When you go to the Jira Change log via the Administration > Jira Integration Settings > Manage Project tab > View logs, you see:
Cause
The custom field specified in the Team mapping in the Administration>Jira Settings > Jira Setup > Organization :
Is of type 'Team' as seen below:
With a custom field type 'Team', the Jira API REST PUT call to update the issue needs a different request body as shown below:
https://<jira_url>/rest/api/2/issue/<issue-key>
{
"update": {
"customfield_10110": [
{
"set": "1"
}
]
}
}
Where 1 is the string of the id of the team you want to update the issue with.
If you specify something else, such as the following request body:
{
"update": {
"customfield_10110": [
{
"set": {
"value": "JIRA_TEAM_NAME"
}
}
]
}
It will fail with the error:
{
"errorMessages": [],
"errors": {
"customfield_10110": "operation must be string"
}
}
On Jira Cloud the error can be slightly different:
{
"errorMessages": [],
"errors": {
"customfield_10001": "The Team must be a string"
}
}
Solution
Use a custom field of type 'Select List (single choice)' type for the team mapping under Administration > Jira Settings > Jira Setup> Organization > JiraProjectName as per the article: Syncing the Team Field Between Jira Software and Jira Align.