Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,364,699
Community Members
 
Community Events
168
Community Groups

Post Fungtion Field Value from compair 2 date picker fields

Hallo Guys,

I need help assigning a value to a number field, comparing 2 field date pickers

field is :
Commitment date (date Picker)
Actual date (date Picker)

project performance by date" (number)

Which help I need :
We compare 2 field value Commitment date and Actual date. If Actual date 1 week more than Commitment date, Project Performance by date value is 10

and I can make same script to make condition Project Performance by date value is 20


Regards,
Tyas

1 answer

1 accepted

0 votes
Answer accepted

Hi Tyas,

I use  post function "Set issue fields" in JMWE. I'm also set it like this picture below 2022-09-14_10-39-57.png

1. Target Issues : Current issue
2. Add Field : Project Performance by date with value 
--------------------------------------------------------------------

{% if issue.fields["Actual date"] | date('diff',issue.fields["Commitment date"],'days') == 7 %}
10
{% elif issue.fields["Actual date"] | date('diff',issue.fields["Commitment date"],'days') != 7 %}
20
{% endif %}

--------------------------------------------------------------------
you can adjust the value as you need


For additional information:
- Actual date, Commitment date are date picker
- Project Performance by date is number field 

Cheers,
Chrishanditya Wisnu Nirwandha

Hi Adit,

thanks for you respont,

I tried to use your script and the result is Project Performance by date (PP) value 10 if Actual date (AD) 7th day of Commitment Date (CD) and other conditions like 4th or 9th day from actual date, Project Performance by date value 20

the big picture what I need
PP value is 30 if the range of AD and CD = > 21 days
PP value is 20 if the range of AD and CD = > 14-21 days
PP value is 10 if the range of AD and CD = > 7-14 days

Regards,
Tyas

Hi Tyas,


You can adjust the value of post function like this script below :
------------------------------------------------------------------------
{% if issue.fields["Actual date"] | date('diff',issue.fields["Commitment date"],'days') >= 7
and issue.fields["Actual date"] | date('diff',issue.fields["Commitment date"],'days') <= 14 %}
10
{% elif issue.fields["Actual date"] | date('diff',issue.fields["Commitment date"],'days') > 14
and issue.fields["Actual date"] | date('diff',issue.fields["Commitment date"],'days') <= 21 %}
20
{% elif issue.fields["Actual date"] | date('diff',issue.fields["Commitment date"],'days') > 21 %}
30
{% endif %}
------------------------------------------------------------------------

you also can use this references :
https://mozilla.github.io/nunjucks/templating.html#if
https://mozilla.github.io/nunjucks/templating.html#math
https://innovalog.atlassian.net/wiki/spaces/JMWEC/pages/141442150/Set+an+Estimate+of+the+issue+to+the+difference+of+two+specific+dates


Cheers,
Chrishanditya Wisnu Nirwandha

Like Hana IT PMO likes this

Hi Adit,


Thanks for your help its work


Regards,
Tyas

Suggest an answer

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

Atlassian Community Events