Forums

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

Increase a field value based on an other field selected value

M C
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!
February 7, 2024

Hi,

I would like to ask if it is possible to create a rule that will be increasing the value of a field based on the options that will be selected for another field.

Specifically, I would like to add a field named X that will keep a weight for each ticket.

Then, based on the selected option of another field, a different value will be added to the Weight field.

So if we select the value A for the field X, the Weight will become Weight + 4

If we select the value B for the field X, the Weight will become Weight + 2

Is this possible?

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.
February 8, 2024

Hi @M C 

Yes, that is possible with an automation rule.  What have you tried thus far to solve this need?

If you have started a rule, and it is not working as you expected, please post an image of your complete automation rule, images of any relevant actions / conditions / branches, an image of the audit log details showing the rule execution, and explain what is not working as expected.  Those will provide context for the community to offer ideas.  Thanks!

 

If you have not started a rule, I encourage you to do so.  Successfully using automation rules requires learning and experimentation.  Just using the rules provided by others will certainly lead to problems maintaining the rules...particularly if the examples provided are incorrect and / or poorly constructed.

To get you started on creating your rule, please refer to these documentation and example sources:

 

As a hint for your rule...

Values in a select option field provide both their id and values to an automation rule.  And so those values could be used to increment another field.

Assuming your Weight field is a number, and there is a field named X with values of:

  • High Importance
  • Medium Importance
  • Low Importance

You could use a Lookup Table to translate the values in field X to numbers, adding them to the Weight like this:

{{issue.Weight.plus(myConversionTable.get(X.value).asNumber)}}

Please look here to learn more about Lookup Tables and math operations:

https://community.atlassian.com/t5/Automation-articles/New-Automation-action-Create-lookup-table/ba-p/2311333

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

Kind regards,
Bill

0 votes
Sharumathy Krishnan
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 8, 2024

Hi @M C 

Welcome to the community!

Yes, we can achieve this using Automation for Jira.

count.png

So, if you see the above example which I tried. I have "Weightage of the ticket" as a select list (single choice) field and Counter (Single line Text field). So, when the issue is been created, if the weightage is chosen and the counter field will get updated by 4 for 5 weightage and 5 for 10 weightages.

Hope this helps!

 

Thanks,

Sharu

Empyra Software Solutions

M C
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!
February 8, 2024

Thank you for your response

I tried something similar but still doesn't work

weight.png

Sharumathy Krishnan
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 9, 2024

Hi @M C 

Kindly provide what is the action performed with this automation which you tried or did you get any error message and so on.

This will help me to resolve your issue.

 

Thanks,

Sharu

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 9, 2024

Smart values cannot be directly added, except for setting number fields.

Otherwise that will produce a text value.  For example, {{issue.ITSU Weight}}+4 will instead concatenate the values, such as 10+4 and not 14.

Please review the documentation for how to add values, either with the inline or longer form math expressions:

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

 

One additional possible cause of the error is the smart value may be incorrect for the field.  Specifically that "ITSU Weight" may be null.

Smart values are name, spacing, and case-sensitive.  And often the smart value does not match the displayed field name on the issue views.  These steps help to identify the correct smart value (and custom field id) for the fields.

The essential steps are:

  • identify an issue which has your field(s)
  • call a REST API function with a browser to search for your issue:
https://<yourinstanceurl>/rest/api/2/issue/<issuekey>?expand=names
  • search on the page for your field, such as with CTRL-F
    • if you find the field, you will also find the smart value, custom field id, and structure / attributes it has
    • if you do not find the field, it is likely supported by automation rules

 

 

Suggest an answer

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

Atlassian Community Events