Hi Guys,
I have fields :
- Start date (Date Picker)
- End date (Date Picker)
- Additional days Overdue (select list (Single choice)), ex : 3,7,14,21
what I need to set "End date" value from post fungtion, if I set "Start date" and "Additional days Overdue".
for exsample : I set "Start date"= 20/07/2022 and "Additional days Overdue"= 7 than post fungtion automate set "End date" value =27/7/2022
Please help me, what can I do In post fungtion ( I used Addons JMWE)
Regards,
Tyas
Hi @Hana IT PMO ,
you can add a Set Issue Fields post-function, configure it to set the End date field, and use this as the value:
{{ issue.fields["Start date"] | date("add", issue.fields["Additional days Overdue"], "days") | date("yyyy-MM-DD") }}
Hi David,
the script not work, End date value just copy value from Start date
and I try change hange "add" to number (ex:7) and input start date 21-07-2022
{{ issue.fields["Start date"] | date("7", issue.fields["Additional days Overdue"], "Days") | date("yyyy-MM-DD") }}
the result is 2001-07-01
Regards,
Tyas
Hi Tyas,
The syntax I provided is correct. But you must make sure the field names are exactly as they appear in the Cudtom Fields page. The safest is to use the Issie Fields help tab under the editor to insert a reference to the fields using the field ID instead.
Also, what is the field type of the Additional days Overdue field?
Hi David,
Additional days Overdue filed type is select list (Single choice) with value 3,7,14,21
Regards,
Tyas
That explains it - my code assumed the field was a number field.
In that case:
{{ issue.fields["Start date"] | date("add", issue.fields["Additional days Overdue"].value, "days") | date("yyyy-MM-DD") }}
I recommend you use the "Issue Fields" help tab when trying to access an issue field's value.
Dear David,
the script work, using your first script
{{ issue.fields["Start date"] | date("add", issue.fields["Additional days Overdue"].value, "days") | date("yyyy-MM-DD") }}
second script not work, it have ".value"
thanks for your help,
Regards,
Tyas