Create Issue does not populate custom fields

I am /rest/api/2/issue/ to create a issue. The issue gets created, but the custom fields that I have in the request don’t get populated. No error is returned and the HTTP response code is 201.
Can somebody tell me what I am doing wrong here?
This is the JSON in the request body:

{
	"fields": {
		"project": {
			"key": "ZRA"
		},
		"summary": "MAT: Unrecognized Format/s found",
		"description": "MAT: Unrecognized Format/s found",
		"issuetype": {
			"name": "Story"
		},
		"customfield_14002": [{
			"name": "12301"
		}],
		"customfield_11200": {
			"name": "RA_Maintenance"
		}
	}
}

This is the specification for customfield_14002

{"id":"customfield_14002","name":"Client(s)","custom":true,"orderable":true,"navigable":true,"searchable":true,"clauseNames":["cf[14002]","Client(s)"],"schema":{"type":"array","items":"option","custom":"com.atlassian.jira.plugin.system.customfieldtypes:multiselect","customId":14002}}

This is the specification for custom field_11200:

{"id":"customfield_11200","name":"Account","custom":true,"orderable":true,"navigable":true,"searchable":true,"clauseNames":["Account","cf[11200]"],"schema":{"type":"account","custom":"com.tempoplugin.tempo-accounts:accounts.customfield","customId":11200}}

Hi @tgiglia,

I believe for a multi select field you should be formatting your request like

"customfield_14002": [{
			"value": "12301"
		}]

I would recommend setting these fields in the UI once and then making a GET request to see how they are structured.

@tgiglia Where you able to figure out how to set the Acount field using the account name? I figured out how to set Account by ID, but struggling with the account name.

@AndyCreech, welcome to the Atlassian developer community.

I can confirm that it’s not possible to use account name. There were multiple options in the past (like when this question was originally opened). More recently, switching to account ids only helped solve a number of privacy issues related to GDPR (and beyond).

1 Like

Well that’s a bummer. Been wracking my brain trying to figure out if there is a way to use smart values to translate account name to account ID in order to set it by name.
Ultimately we are trying to auto set the account based on the Jira Management: Organization field.

Only solution I can come up with now is use brute force of nested hard coded if, then statements within Automation. Will be a bear to maintain.

@AndyCreech,

I don’t completely follow the use case you described. Can you back up from the implementation details and explain the logic you wish you could express?

@ibuchanan

So we use the Jira Service Management (JSM) module to track client issues, UAT and change requests and Jira Software to track development changes. We are working on implementing Tempo Time across our Atlassian Cloud set-up in order to gain better insights into time spent on client projects, client support, internal overhead and R&D tax credits.

As part of that set-up we want to add Tempo Time accounts to the JSM issues so that time logged against JSM issues can be rolled up to the client. Tempo Time reporting does not support the Organization custom field on JSM issues, so I want to add a corresponding Account to JSM issues that matches the client Organization field. I was hoping this is where I was hoping Automation for Jira solution could come in since you can write custom JSON for updating an issue.

This is where I am running into a roadblock. I can create Organizations that have the same name as client Accounts in Tempo Time, but you cannot set Account by Name due to the implementation of that field.

Thank you for taking the time to engage :slight_smile:

1 Like