Automation rule isn't recognising custom field as numerical

Lucy Cookney July 6, 2021

Hi

Can anybody help me?

I'm trying to set up an automation rule which divides one field by another and populates a third field with the result.  It's failing, saying that the first field isn't numerical 'CoD - 10081'.

Capture.PNG

4 answers

2 accepted

4 votes
Answer accepted
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 6, 2021

Hi @Lucy Cookney 

To perform that math operation on your CoD (Cost of Delay) to determine WSJF (weighted shortest job first), you need to use math operators:

{{#=}}{{issue.customField_10081}} / {{issue.customField_10024}}{{/}}

or

{{issue.customField_10081.divide(issue.customField_10024)}}

Please look here for more information:

https://support.atlassian.com/jira-software-cloud/docs/smart-values-math-expressions/

Best regards,
Bill

Lucy Cookney July 7, 2021

Hi @Bill Sheboy 

Thanks for the reply.

The second option appears to be accepted...but it's not populating the WSJF field.

I have the success message:

Capture.PNG

But the field is blank:

Capture.PNG

Thanks

Lucy

Lucy Cookney July 7, 2021

Oh that's strange, I've switched the numbers around to:

{{issue.customField_10024.divide(issue.customField_10081)}}

It's populating the field but with the incorrect answer:

Screenshot 2021-07-07 143042.png

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 7, 2021

Okay...connecting my questions together where I believe John was heading:

You are showing the field names on the issue view, and have you confirmed how those match to the custom field IDs you are using in the calculation?

Let's try this:

  • Using the Log Action, please write each of your calculation parameters to the log so you can compare what you believe is being used versus what is in the fields.
  • Using the instructions in this post, please use an example story to confirm the custom field ids (and smart values) match what you expect: https://support.atlassian.com/jira-software-cloud/docs/find-the-smart-value-for-a-field/
    • basically you call the REST API with a browser, and get back the data for an issue...with the associated field names and data.

Thanks!

Like ā€¢ Lucy Cookney likes this
Lucy Cookney July 8, 2021

Ah thank you so much for the help...I've figured out why it wasn't working....

So I have a calculated field in CoD - it updates when I amend User/Business Value, Time Criticality, and RR|OE Value and adds them all together.

So my calculation for the WSJF field was updating as soon as I updated one of those and it was using the old value in CoD (silly me).

However, now I have changed it to make sure it only updates when either CoD or Story Points is updated - it doesn't recognise CoD being updated as it's being done by another automation rule.  I'm guessing it must be a limitation so might need to schedule it to run periodically šŸ¤”

Like ā€¢ Bill Sheboy likes this
Lucy Cookney July 8, 2021

I should say, I figured out what was wrong because you showed me how to use the log action so thank you! šŸ˜

Like ā€¢ # people like this
2 votes
Answer accepted
Lucy Cookney July 8, 2021

Thank you everyone for the help.  I have now amended my rule to the below.  Feel free to suggest anything better but this appears to work šŸ˜

Capture.PNG

Capture.PNG

1 vote
John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 6, 2021

Hi Lucy,

Can you share a screen shot of the list of custom fields where it shows the field type?

Also, can you show the error message in the audit log that you are receiving? 

Do either of the fields contain a value of 0

Lucy Cookney July 7, 2021

Hi @John Funk 

Number fields:

Capture.PNG

Capture.PNG

I was getting this error message:

Capture.PNG

However, I am now using the expression:

{{issue.customField_10081.divide(issue.customField_10024)}}

This is showing as successful but the WSFJ field isn't populating:

Capture.PNG

Capture.PNG

Thanks

Lucy

John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 7, 2021

Which field is 10081 and which field is 10024?

And can you share the rule that shows where you are updating the field with the formula? 

Lucy Cookney July 7, 2021

10081 is CoD and 10024 is Story Points

Screenshot 2021-07-07 141404.png

Lucy Cookney July 7, 2021

I want to find CoD divided by Story Points

John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 7, 2021

When I look at the error, it mentions the value it is trying to get for WSJF is /5.0

which seems to suggest that you are trying to divide by the Time Critically field since it has a value of 5. So if that field is wrong, I am suspicion that you are not using the right field for the first number either. 

So I would just use the field name and see what happens. Try it with this:

{{issue.CoD.divide(issue.Story Points)}}

Like ā€¢ Lucy Cookney likes this
Lucy Cookney July 8, 2021

Thanks so much for your help, I didn't know I could use the custom fields names!  I was definitely using the wrong ID in my original calculation as it is now "working" but with a limitation that I assume isn't something I can do anything about.

Please see my message above that explains šŸ˜Š.

Like ā€¢ John Funk likes this
1 vote
Joshua Sneed Contegix
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 6, 2021

Hi Lucy,

What type of field is CoD? Cheers!

Lucy Cookney July 7, 2021

Hi @Joshua Sneed Contegix 

It is a custom number field.

Thanks

Lucy

Suggest an answer

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

Atlassian Community Events