Missed Team ’24? Catch up on announcements here.

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

Automation won't let me select SET for my custom field

Kel Hill November 17, 2023

First time trying to update a custom field from within an automation. When I select Edit Issue, I am able to search and find my custom field, but the only option is "This field will be cleared". If I try to select SET, nothing changes and "This field will be cleared" persists. I want to be able to insert this into my custom field:

{
"fields": {
"{{13496}}": "{{#numberFormat}}(((issue.fields.resolutiondate.value - issue.fields.created.value) / (1000 * 60 * 60)).toFixed(1), '0.0'){{/numberFormat}}"
}
}

1 answer

1 accepted

3 votes
Answer accepted
Felipe Pérez _ServiceRocket_ November 18, 2023

Hi Kel!

Hope you're doing great! Regarding your question:

  • If I try to select SET, nothing changes, and "This field will be cleared" persists. I want to be able to insert this into my custom field:

In order to use a JSON structure to set values to a field via automation, you don't need to select the field under the "Choose field to set" option. You should leave this unselected.

Then, go to "More Options" and paste the JSON there, with this, the automation will know which field you want to set and its value. More information about JSON usage within Jira automation can be found in the following documentation: Advanced field editing using JSON 

Finally, try to use the following structure within your automation, this should do the trick:

{
"update": {
"customfield_13496": [
{
"set": {{#numberFormat}}(((issue.fields.resolutiondate.value -issue.fields.created.value) / (1000 * 60 * 60)).toFixed(1), '0.0'){{/numberFormat}}
}
]
}
}

Please check the following image for a better understanding of how to do it, hope it helps!

image.png

Regards,
Felipe

ServiceRocket Apps Support

-We've Got Your Back!

Kel Hill November 19, 2023

Thanks @Felipe Pérez _ServiceRocket_ for clarifying that the field does not need to be selected, as I was not sure of that requirement.

I have turned off the field selection and tried the JSON format you provided, but I am getting a JSON error message in the automation's log when it attempts to execute. Can you see anything wrong with the JSON?  I did have an AI site help me come up with it, and I've more wrong answers from AI than correct answers in my dealings with it so far, lol!

The automation log error reads...

Edit issue
Error while parsing additional fields. Not valid JSON.

My custom field is just a short text field and I just need JSON to sutract the created date/time from the resolved date/time and to format the result as a number of hours (preferably as the date/time value that Excel understands, if that's possible).

Kel Hill November 30, 2023

My custom field is still not being populated by the automation. My current JSON is as follows, and it is triggered simply when an issue transitions to Closed.

{
"actions": [
{
"update": {
"customfield_13496": [
{
"set": {
"value": "{{((issue.resolutiondate.epochMillis - issue.created.epochMillis) / 3600000) | number_format(2) + ' hours'}}"
}
}
]
}
}
]
}

Felipe Pérez _ServiceRocket_ December 1, 2023

Hi Kel! 

I'm sorry the automation didn't work out as expected with the information provided.

Since this has become more complex, I suggest you contact atlassian support for more information about this here: Atlassian Support. To get them, you need to have a Standard plan, but no worries, you can start a trial of 14 days without any charge.

Apologies for not being more helpful on this but it goes beyond my technical knowledge of jira automation.

I hope you a great day ahead.

Regards,
Felipe

ServiceRocket Apps Support

-We've Got Your Back!

Kel Hill December 1, 2023

Thanks @Felipe Pérez _ServiceRocket_ 
Appreciate your help. It's so frustrating that Atlassian Service Management - software designed for support management - does not natively have duration staistics and reporting built in!
I have found an app that will do what I was looking to accomplish with that automation.

Thanks again.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events