I have 4 single select list custom fields all with the same values which are alphanumeric:
I want to calculate a new numeric field from these values, I was hoping to do something like below but it is not working. I am not sure if the main problem is being the alphanumeric field values I am trying to pull as I can't even seem to pull one custom field value into my new field.
{{#=}}{{issue.customfield.asNumber}} + {{issue.customfield.asNumber}} +{{issue.customfield.asNumber}} +{{issue.customfield.asNumber}} + {{/}}
I am not interested in any add-on's just want to know if I can do this with smart values.
Hi @Dani Miles
As your single-select values contain a number and text, you could extract the number before the operations, such as using the left() function: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-text-fields/#left-int-length-
For example:
{{issue.customfieldA.value.left(1).asNumber|0}}
I added a default of 0 to the end of the expression.
Kind regards,
Bill
Thanks Bill, this worked perfectly. I had tried {{issue.summary.charAt(1)}} which hadn't worked but this worked perfectly.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Dani Miles ,
the alphanumeric value might be the issue. Try with just number field and it should work.
{{#=}}{{issue.customfield1}}+{{issue.fcustomfield2}}+...{{/}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Najm,
You were right it didn't like the alpha characters I just needed a way to strip them.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.