Hi Team, Want to add values of two custom fields and based on the sum, want to put some conditions

Sabyasachi Samal
Contributor
May 4, 2024

Example:

There are two custom fields as "Dev Estimation" and "QA Estimation". I want to sum this with conditions like if the sum is greater than equals to 1 and less than equals to 3, then need to update the Story points field as 1.

Tried this with below logics using smart value but getting error. Please let me know how to achieve the same. PS: do not want to create one custom field to store the summed value. I am using JIRA cloud.

{{#if(and(((issue.Dev Estimation) + (issue.QA Estimation)).gte(1),((issue.Dev Estimation) + (issue.QA Estimation)).lte(3)))}}(issue.Story Points = 1) {{/}}

2 answers

1 accepted

2 votes
Answer accepted
YY Brother
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 4, 2024

Hi @Sabyasachi Samal 

Welcome to our Community.

Please try to use a {Create variable} action to store the sum of dev & QA estimations:

{{#=}}{{issue.Dev Estimation|0}} + {{issue.QA Estimation|0}}{{/}}

Then use if-else condition to edit the value of Story points.

Hope it helps & Thanks,

YY哥, Atlassian Certified Expert

Cloze Tech, China

Sabyasachi Samal
Contributor
May 4, 2024

Hi @YY Brother Thank you for the response. The Create variable is working fine. But not able to update the Story points. I want below logic to work and if you can help me. Also please find the rules I am using, Please let me know if this is the correct way.

{{#if(and(TotalEstimation.gte(1),TotalEstimation.lte(2)))}} {{issue.Story Points.Value = 1}} {{/}}

Story point.png

Sabyasachi Samal
Contributor
May 4, 2024

Hi @YY Brother Tried using below way also, it only executes first if condition.Story point2.png

YY Brother
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 5, 2024

Hi @Sabyasachi Samal 

It seems the condition is not correct. Please use this condition:image.png

image.png

Thanks,

YY哥

Sabyasachi Samal
Contributor
May 7, 2024

Hi @YY Brother 

Thanks It worked as expected now. Thanks a lot.

YY Brother
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 7, 2024

Good news! It's pleasure @Sabyasachi Samal 

Like Sabyasachi Samal likes this
Sabyasachi Samal
Contributor
May 7, 2024

Many thanks to you @YY Brother taking time for my silly queries. 

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.
May 4, 2024

Hi @Sabyasachi Samal 

To assist with automation rule questions, context is needed.  Please post the following to help the community offer suggestions:

  • 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 with any errors, and
  • explain what is not working as expected.

Thanks!

Kind regards,
Bill

Sabyasachi Samal
Contributor
May 4, 2024

Hi @Bill Sheboy Thanks for your response. Please find the rule details I am using. It is executed successfully but the Story Points field is not updating properly.Story point.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.
May 5, 2024

Thanks for that information.

The "more options" and "additional fields" sections of the Edit Issue Action use JSON, as described here: https://support.atlassian.com/cloud-automation/docs/advanced-field-editing-using-json/

However you should not need those for your scenario, as the field could be selected from the dropdown list and then set using a smart value expression. 

 

Your expressions are incorrect for setting the field.  Please review the documentation for conditional logic: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-conditional-logic/

Also, Created Variables are text, and so must be converted to number values with asNumber to be used as you show: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-text-fields/#asNumber

 

Sabyasachi Samal
Contributor
May 7, 2024

@Bill Sheboy I tried with all the reference you shared. Still it is not working as expected.Story point4.pngStory point3.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.
May 7, 2024

The rule you now show is very different from your original approach, and is incorrect for different reasons. 

As you appear to have already solved the need using if / else conditions, perhaps use that approach and remove this other rule.

Sabyasachi Samal
Contributor
May 7, 2024

I have changed based on suggestions. Tried different possible ways but finally the if/else works. Thank you for your help.

Suggest an answer

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

Atlassian Community Events