JIRA Automation Scoring an Issue based on the values of fields

Lindsey Dobson
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!
November 27, 2024

I am hoping someone can shed some light on the apparent syntax error I am getting for the below smart value formula I am using.

The purpose is to assign the issue a priority rank score based on the options filled out when the form is submitted and then subsequently updated.

All the field names are correct, with Story Points being the only built in field referenced.

Any help would be greatly appreciated!!

I get this error in the audit log:

  • Error rendering smart-values when executing this rule: Missing parameter(s) for operator +u: ( + + + + + + ) + ( + + + ) + ( + + ) + ( + + )

 

Code:

 

 

 

{{#=}}
(
  {{#if(issue.customfield_31600.contains("Will this feed a MIpack?"))}}7{{/}}
  + {{#if(issue.customfield_31600.contains("Going to the Global Teams?"))}}8{{/}}
  + {{#if(issue.customfield_31600.contains("Directly impacts customers?"))}}10{{/}}
  + {{#if(issue.customfield_31600.contains("Result in a cost FTE save?"))}}6{{/}}
  + {{#if(issue.customfield_31600.contains("Part of controls?"))}}8{{/}}
  + {{#if(issue.customfield_31600.contains("Forms part of reporting?"))}}10{{/}}
  + {{#if(issue.customfield_31600.contains("Related to CRM?"))}}5{{/}}
)
+
(
  {{#if(issue.storyPoints <= 0.25)}}9{{/}}
  + {{#if(issue.storyPoints > 0.25 and issue.StoryPoints <= 1.25)}}6{{/}}
  + {{#if(issue.storyPoints > 1.25 and issue.storyPoints <= 2.25)}}3{{/}}
  + {{#if(issue.storyPoints > 2.25)}}1{{/}}
)
+
(
  {{#if(now.diff(issue.created).days < 15)}}1{{/}}
  + {{#if(now.diff(issue.created).days >= 15 and now.diff(issue.created).days <= 45)}}3{{/}}
  + {{#if(now.diff(issue.created).days >= 45 and now.diff(issue.created).days <= 90)}}6{{/}}
  + {{#if(now.diff(issue.created).days > 90)}}5{{/}}
)
+
(
  {{#if(issue.customfield_24404== "High")}}8{{/}}
  + {{#if(issue.customfield_24404== "Medium")}}5{{/}}
  + {{#if(issue.customfield_24404== "Low")}}2{{/}}
)
+
(
  {{#if(issue.customfield_15814== "High")}}8{{/}}
  + {{#if(issue.customfield_15814== "Medium")}}5{{/}}
  + {{#if(issue.customfield_15814== "Low")}}2{{/}}
)
{{/}}

2 answers

0 votes
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.
November 28, 2024

Hi @Lindsey Dobson -- Welcome to the Atlassian Community!

First thing, you may want to use Lookup Tables to perform the translation of values to numbers.  That will make your expression much simpler, such as creating a table for each translation and then summing without conditions.  Please look here to learn more: https://community.atlassian.com/t5/Automation-articles/Update-Create-lookup-table-action-improvements/ba-p/2427798

 

Reviewing the details of your expression...

Your smart value expression is using the format of conditional which only returns a value when "true": https://support.atlassian.com/cloud-automation/docs/jira-smart-values-conditional-logic/

What do you want to happen if the values do not match, and are "false": use 0, or some other value?

 

What are the types of your fields, such as customfield_31600: text, select option, etc.?  As written, your expression for such fields will only work for text fields. 

For select option fields, you must add the value attribute, such as with {{issue.customfield_31600.value}}  That could contain multiple values if the field type is multiple-selection, and so additional logic or a match() expression could be used.

 

Smart values are name, spacing, and case-sensitive, and the correct one for the "Story Points" field in a company-managed project is {{issue.Story Points}} or {{issue.Story points}}.  For a team-managed project, the "Story Point Estimate" field is used, with the smart value of {{issue.Story point estimate}}  To learn the available smart values for an issue, please use this how-to article: https://support.atlassian.com/cloud-automation/docs/find-the-smart-value-for-a-field/

 

Your expression is using the incorrect format for conditional expressions for number values.  Instead consider using the inline math tests such as greater than gt() and less than or equal to le(): https://support.atlassian.com/cloud-automation/docs/jira-smart-values-math-expressions/

This will also need to use the logical and() function: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-conditional-logic/#and

 

Kind regards,
Bill

0 votes
Dick
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.
November 28, 2024

Hi @Lindsey Dobson , Welcome to the Atlassian Community

It seems you're using expressions that do not exist in the Atlassian documentation on smart values: smart-values-text-fields  and smart-values-math-expressions/ 

  • Text comparisons are made using match instead of contains
    {{issue.summary.match(".*(lo).*")}} -> lo {{issue.summary.match(".*(o).*")}} -> [o, o]
  • Numerical comparisons are made using .gt and .gte instead of > and >=
    {{#if(issue.Votes.gte(100))}} Popular issue {{/}}

 

Hope this helps

Dick

Suggest an answer

Log in or Sign up to answer