Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How can I update a Single Select Custom Field using an Automation?

John Izquierdo March 6, 2024

Hi,

 

I have a Microsoft Form that creates a ticket in Jira. From there I have an automation set up to grab the data from the issue description and place it in various custom fields. I have no issues setting the values to date picker and single-line/paragraph custom fields, the only issue is with single select fields.

I'm using the .match() smart-value function to accomplish this.

Example of the issue Description:

First Name: John

Last Name: Smith

Company: Smith & John, LLC.

Example of a value in the Automation for the custom field, First Name:

{{issue.description.match("^First Name: *(.*)")}}

 

The above works fine because it's updating a text field. When I try the same concept for a single-select field it doesn't do anything and automation has an error. I tried the JSON below.

{
"fields": {
"customfield_11299": {"value": "{{issue.description.match("^Company: *(.*)")}}"}
}
}

But I get the error, "(Specify a valid value for Company (customfield_11299))"

 

I've even tried,

{
"fields": {
"customfield_11299": {"value": "{{issue.description.match("^Company: *(.*)").toJsonString}}"}
}
}

 

Then I get an error, "Invalid JSON".

 

Please help!

2 answers

2 accepted

3 votes
Answer accepted
Mikael Sandberg
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 6, 2024

Make sure you add .trim() to your smart value, I had a similar issue where the field was not set even though the audit log showed that the value was correct. After I added .trim() everything worked.

John Izquierdo March 6, 2024

Thanks, Mikael!

Like # people like this
2 votes
Answer accepted
Jack Brickey
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 6, 2024

Hi @John Izquierdo , it would be interesting to add a log action to capture the 'value' of Company to see if it matches that of available single select options. If that proves successful I might try using a Variable action to store the value and then use the variable in the edit action.

John Izquierdo March 6, 2024

Thanks @Jack Brickey ! Log action captured the 'value' which matched the single select option. I'm now able to get it to enter the value into the custom field (after add the .trim(), thank you @Mikael Sandberg ).

For reasons we're not using the Jira form (waiting to fully setup Refined since it looks nicer) and not being able to do this was going to add too much manual work for our HR team. Probably TMI but, we're configuring our Onboarding Process in Jira which interacts with 12 different departments and without this I was just adding all the information formatted neatly in a comment for HR to manually update the custom fields - which would not be a fun time for them.

I do have another question, similar issue. How would I select the options for a multi-select custom field from the description? Below is an example of what the 'value' looks like in the description.

 

["dual monitors","docking station","keyboard","mouse"] 

Like # people like this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events