Forums

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

Post Fungtion Field Value from compair 2 date picker fields

Hana IT PMO September 12, 2022

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
chrishanditya
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!
September 13, 2022

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

Hana IT PMO September 13, 2022

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

chrishanditya
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!
September 13, 2022

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
Hana IT PMO September 13, 2022

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
Product Admin
TAGS
AUG Leaders

Atlassian Community Events