Custom fields - select options not recognized as numbers

Ryan Rayfield February 27, 2024

I'm looking to create a formular made up of a number of custom fields. Each custom field is a selected value 1,3,5,8,13. In my final formula these are all recognized as "1" so in both the roll up and the custom formula, adding three fields together, no matter their selected value = 3

Update:

Wasn't sure if it was better to answer here or edit my original question but I ended up 1. adding weights to the single-select options that equal the "number value" I was looking for and then 2. simplifying the equation by creating a separate roll-up value for the fields I was adding together. I'm uncertain if the second piece was necessary but it worked so I moved on. Will test out your answer @Bill Sheboy for posterity! Here is a screenshot of what I have working now. The final formula is shown in column 1, the "cost of delay" is a sum of the next three columns.

Screenshot 2024-03-01 154804.png

3 answers

1 vote
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.
February 27, 2024

Hi @Ryan Rayfield 

Without seeing the details of your rule or fields, I am hypothesizing these are single-select option fields.  If so, to use the value of the selection, add the value attribute.  Perhaps like this:

{{#=}}{{issue.customfield_12345.value}} + {{issue.customfield_67890.value}}{{/}}

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

Kind regards,
Bill

Ryan Rayfield March 1, 2024

I was unable to add the {{#=}} nor the ".value" to my formula. Is it possible I need to find the custom field ID somewhere, or that Jira Product Discover has different syntax? See screenshot where I get the wrong value (7*3=3), and subsequent one where the formula is invalid when adding ".value"incorrect value.pnginvalid expression.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.
March 1, 2024

Update: the below suggestion does not work.

As you are doing the calculation in a JPD custom formula for a field you only need to use the field name for the calculation.  For example:

{test number single select} * 3

 

Ryan Rayfield March 1, 2024

Right so check out the first screenshot - so i get “3” instead of “21” when the {test number single select} =7

this was the initial problem I encountered.

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.
March 1, 2024

Well, that is surprising that custom formulas apparently do not support that for JPD: https://support.atlassian.com/jira-product-discovery/docs/expression-based-formulas/  I will strikethrough my incorrect suggestions above.

Back to my initial suggestion: use a number field rather than a "custom formula" field, and an automation rule, triggered on a change to either option field to sum their value attributes.

You may need this how-to article to confirm the smart value (or custom field id) for the fields in order to use them: https://support.atlassian.com/cloud-automation/docs/find-the-smart-value-for-a-field/

0 votes
Ryan Rayfield March 5, 2024

Ended up just using the custom select type and adding a specific weight as mentioned in my edit for the post above. This way I was able to keep the selection limited to the numbers I wanted to present and have the formula pick up the integers (the weights) properly!

0 votes
Kalyan Sattaluri
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.
February 27, 2024

Hello @Ryan Rayfield 

Welcome. To help, we will need screenshot of your audit logs of each of the custom fields to see if you have the right smart values.

We will also need the formula you are using which is not giving you the result.

So in your rule, Action -> Log and do one for each smart value which shows the value you have selected and share your results.

{{customfield_10001}}

{{customfield_10002}}

{{customfield_10003}}

{{#=}} {{customfield_10001}} + {{customfield_10002}} +{{customfield_10003}} {{/}}

Suggest an answer

Log in or Sign up to answer