Trying to edit select field with Value not ID

Hi

I am trying to Edit a field through Automation using JSON on a custom field.

I would like to set the Cusom field Company with the value of Abcde

{
 "fields": {
    "Company": {
        "value": "Abcde"
    }
 }
}

The above gives me this error:

XXX-85 (Can not deserialize instance of java.lang.Long out of START_OBJECT token at [Source: N/A; line: -1, column: -1] (app-key__field-key))

Please advise?
Thank you

@YatishMadhav The docs for how to update a custom field using JSON on an Automation rule can be found here:

Try something like this:

{
  "fields": {
    "Company": "Abcde"
  }
}

Alternatively, if you have multiple custom fields with the same name, or your custom field is the same as a system field, then you should use the customfield_12345 (ID-based) naming convention.

Oh, and one more thing. I noticed that your JSON had some kind of smart quotes (instead of straight " quotation marks "). The Automation tool definitely doesn’t like those. I recommend running your JSON through a linter/validator before you save/publish your rule.

Hi

I have tried that - see results below. I wonder why it is not working - probably becuase it is a field that is populated by the REST API and is part of the custom connect app field module?

With Company
Can not construct instance of java.lang.Long from String value ‘ABCDE’: not a valid Long value at [Source: N/A; line: -1, column: -1] (app_key__app_field_key)

With customfield_####
Can not construct instance of java.lang.Long from String value ‘ABCDE’: not a valid Long value at [Source: N/A; line: -1, column: -1] (app_key__app_field_key)

Please advise?

Thank you
Yatish

@YatishMadhav Just to clarify, this is an Issue Field that you defined in your Connect descriptor, correct? https://developer.atlassian.com/cloud/jira/platform/modules/issue-field/

Would you mind pasting the part of your descriptor (atlassian-connect.json) that contains the jiraIssueFields?

NOTE: I haven’t given it a try yet in Automation, but I will try to get to it later this afternoon… but according to the docs above, you need to reference this type of Issue Field with the following format:

The key of the field, that can be used to reference the field in the REST API, is:
$(app-key)__$(module-key)

Hi @nmansilla

That is correct. It is a single_select type field. Here is the snippet (we do have more fields but this can be used as example) - also, I have verified that the the value I want to populate does exist in the dropdown:

	"modules":
	{
		"jiraIssueFields": [
			{
				"name":
				{
					"value": "Company"
				},
				"description":
				{
					"value": "Company"
				},
				"type": "single_select",
				"key": "company"
			}
		]
	}

Hmm - OK, I will give that a try in the JSON in the automation rule to edit / create the issue to set the value based on the value.

Please let me know if you try and if it works. I will do the same on my end.

Thank you
Yatish

Hi
I got this :frowning: note that striata-sphere is the app key and company is the field key as defined in the above JSON.

When using:

{"fields":{"striata-sphere__company":{"value": "Abcde"}}}

Screenshot from 2023-02-15 11-26-59

Please advise?

Thank you
Yatish

Hi @YatishMadhav, the format should resemble what’s below, where 123 is the option ID. You can fetch a list of issue field options using Get Selectable Issue Field Options method.

{
   "fields":{
      "striata-sphere__company": 123
   }
}

Thanks @nmansilla for checking and feeding back - though what my original request for this is to set a select based on hte value and not the ID :slight_smile:
I can do so if I have the ID, but what I have a value in the description that I extract to an automation variable and then need to update the select based on that value.

Any idea?

Thank you

Just bubbling this up - I hope there is some way I can set a a single or multi select using automation Edit issue action with Json using the option name and not option ID? Thank you in advance.

(I really hope I am not bugging anyone by posting number of replies here) any workaround or solution to this please? Thank you

Hello