Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Failed to update custom field through a transition using smart value- math expression

Wei Zhang
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 22, 2020

I added a custom field "rework_count" and tried to add 1 every time people reopen the issue. I added a POST function to the transition. 
But I got an error "transition failed". Please let me know if there is an issue with my expression.

image.pngimage.png

2 answers

0 votes
Marlene Kegel - codefortynine
Atlassian Partner
October 29, 2020

Hi @Wei Zhang ,

If you don't work with Jira Automation you could also try our Jira cloud app Dynamic Fields for Jira.

With our app you can create a field "rework_count" that counts how many times an issue was reopened.

This is how your custom expression could look like:

issue.changelogs.filter(changelog => changelog.items.some(item => item.fieldId == 'status' && item.toString == 'Reopened')).length

Replace "Reopened" with the name of the status you'd like to count. You can also use item.to and the status' ID instead.

If you need support in creating your custom dynamic field, don't hesitate to get in touch with our support.

0 votes
John Funk
Community Champion
October 23, 2020

Hi Wei,

You should create that as an Automation For Jira rule and not do it in the post function in this case. 

So create an Issue Transitioned trigger rule.

Then add any conditions you might want.

Then add a New Action for Edit Issue. 

Select the Rework Count field and add your above code into that field. 

Suggest an answer

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

Atlassian Community Events