Error setting custom field for Organization

When updating an issue to set the organization custom field, I am getting an error saying the organization Id must be a number. But that is what I am sending. This is using the Jira Cloud API for the issue as I don’t see anything specific to this in the JSM API docs. What am I missing here?

@RandyKnight welcome to the Atlassian developer community.

Quotes around a number make it a string.

{
    "fields": {
        "customfield_10002": [{"id": 10}]
    }
}
1 Like

Hi @ibuchanan ,

I’m using the format suggested by you but still getting the same error. Could you please help me to sort the issue?
image

Regards,
Chethan

@ChethanGR,

Maybe we both weren’t reading the error literally enough. Have you tried:

{
    "fields": {
        "customfield_10002": 10
    }
}

Hi @ibuchanan ,

The following worked for me.

{
    "fields": {
        "customfield_10002": [10]
    }
}

Regards,
Chethan

1 Like

That’s right, Organizations custom field needs an array of ids (numbers) which represent each of the organizations to be added to the custom field.
Your organization ids are listed under this endpoint: /rest/servicedeskapi/organization?start=0&limit=50
And to modify or add to the Organizations custom field, you need the ids (as numbers, don’t you dear to pass them as a string! :stuck_out_tongue: ) in a nice array like this:

{
    "fields": {
        "customfield_10002": [10, 11, 301]
    }
}
1 Like