Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

JMWE: additional condition for calculating field values

How is it possible to build in an addtional condition for an event based "issue-field-value-changed"+"set-issue-field"-post function?

E.g.:

if the value of a field A is between 0 and 100, then set the value for filed B = 1,

if the value of a field A is between 100 and 200, then set the value for filed B = 2,

and so on

 

1 answer

0 votes

Hi @Dmitry Kharishman 

you don't need a condition for that - what you want is to use the Set Issue Fields post-function in the event-based action to set field B to a value calculated based on field A, using a Nunjucks expression. For example:

{% if issue.fields["A"] <= 100 %}
1
{% elif issue.fields["A"] <= 200 %}
2
{% else %}
3
{% endif %}

Hi David,

Thank you very much

Could you please support me with the format?

I would like to calculate the value for the field "Score" based on the formula below.

The dominator in the formula should become the values 1, 2, 3, 5 or 8 depending on the value for the field "Σ Original Estimate".

{{ (issue.fields["Business Value"] + issue.fields["Time Criticality"] + issue.fields["Risk Reduction"]) / ({% if issue.fields["Σ Original Estimate"] < 14400 %}
1
{% elif issue.fields["Σ Original Estimate"] < 28800 %}
2
{% elif issue.fields["Σ Original Estimate"] < 43200 %}
3
{% elif issue.fields["Σ Original Estimate"] < 72000 %}
4
{% elif issue.fields["Σ Original Estimate"] < 115200 %}
5
{% else %}
8
{% endif %}) }}

 

Many thanks

Hi @Dmitry Kharishman ,

try this:

{% if issue.fields["Σ Original Estimate"] < 14400 %}
{% set denom = 1 %}
{% elif issue.fields["Σ Original Estimate"] < 28800 %}

{% set denom = 2 %}
{% elif issue.fields["Σ Original Estimate"] < 43200 %}

{% set denom = 3 %}
{% elif issue.fields["Σ Original Estimate"] < 72000 %}
{% set denom = 4 %}
{% elif issue.fields["Σ Original Estimate"] < 115200 %}
{% set denom = 5 %}
{% else %}
{% set denom = 8 %}
{% endif %}
{{ (issue.fields["Business Value"] + issue.fields["Time Criticality"] + issue.fields["Risk Reduction"]) / denom }}

Thank you a lot. It works!

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira Software

👋 Looking for 15-20 volunteers to test Atlassian training content

Hi everyone! Are you interested in beta testing Atlassian University’s newest (unreleased!) training course? We’re looking for 15-20 volunteers to test our newest training course, Basic reporting...

428 views 19 22
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you