JMWE Update date for all cascading linked issues

Joseph HANI
Contributor
February 14, 2025

Hello everyone ! 

I hope you're doing great ! 

I'm trying to set up a JMWE Event based-actions where, if the start date (or due date) of an issue A change, the start date of all the cascading issue : 

- Issue A block Issue B

- Issue B block Issue C

- Issue C block Issue D

- ... 

 Should also shift by the same number of days. I've successfully made it using Jira cloud Automation, but it seems that I'm being block by the loop limit of 10 execution ... and I can't figured out ... so I thought that JMWE could be the answer to all my problem ... lol 

 

Using JMWE I can't find how / where to calculate the dateDifference and make it update on all cascading issue ... 

I suppose that if it's an Event based-actions it will trigger all the cascading issue since they will update their start date 

 

Any help will be greatly appreciated ! 

Have a nice week end ! 

 

You can find the automation solution here : 

https://community.atlassian.com/t5/Jira-questions/Automation-Update-date-value-based-on-a-variable/qaq-p/2927507#M1103299


3 answers

1 accepted

Suggest an answer

Log in or Sign up to answer
1 vote
Answer accepted
David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 21, 2025

Hi @Joseph HANI 

the Nunjucks template is somewhat incorrect. Try this instead:

{% set oldStartDate = context.changelog.fields.customfield_10083.from %}
{% set newStartDate = context.changelog.fields.customfield_10083.to %}
{% set linkedStartDate = targetIssue.fields.customfield_10083 %}

{% if oldStartDate and newStartDate %}
{% set shiftDays = newStartDate | date("diff", oldStartDate, "days" ) %}
{% if linkedStartDate and shiftDays != 0 %}
{{ linkedStartDate | dateadd(shiftDays, "d") | date("YYYY-MM-DD") }}
{% endif %}
{% endif %}

And make sure you check the "Ignore empty value" option for that field. 

 

image.png

Joseph HANI
Contributor
February 24, 2025

@David Fischer You are a genius man ! 

Thank you soooo much it is working great !! Exactly as intended !! 

You have made my day !!! 🙏

0 votes
Joseph HANI
Contributor
February 21, 2025

If anyone has an idea, I'm still struggling. So far I went with this : 

{% set oldStartDate = fieldChange.before %}
{% set newStartDate = fieldChange.after %}
{% set linkedStartDate = issue.fields.customfield_10083 %}

{% if oldStartDate and newStartDate %}
{% set shiftDays = ((newStartDate | date("U")) - (oldStartDate | date("U"))) / 86400 | round %}

{% if linkedStartDate and shiftDays != 0 %}
{{ linkedStartDate | dateadd(shiftDays, "d") | date("YYYY-MM-DD") }}
{% else %}
{{ linkedStartDate | date("YYYY-MM-DD") }}
{% endif %}
{% else %}
{{ linkedStartDate | date("YYYY-MM-DD") }}
{% endif %}

Problem I have is that it set up the same date value as Issue A and do not do calculate the number of days shifted ... 

Sorry to trigger your name @David Fischer You have helped me numerous times on JMWE, maybe you could let me know if you think it's possible or not.... 

Thank you ! 

David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 21, 2025

Hi @Joseph HANI 

can you share the full configuration of your event-based action?

Like Joseph HANI likes this
Joseph HANI
Contributor
February 21, 2025

Oh my god you answered, so sorry to have trigger your name like this, You're my last resort, I'd never have done this otherwise.

Here is the screen @David Fischer 
Screenshot-2025-02-211.jpg

 

Screenshot-2025-02-212.jpg

 Related code in "New value" 

{% set oldStartDate = fieldChange.before %}
{% set newStartDate = fieldChange.after %}
{% set linkedStartDate = issue.fields.customfield_10083 %}

{% if oldStartDate and newStartDate %}
{% set shiftDays = ((newStartDate | date("U")) - (oldStartDate | date("U"))) / 86400 | round %}

{% if linkedStartDate and shiftDays != 0 %}
{{ linkedStartDate | dateadd(shiftDays, "d") | date("YYYY-MM-DD") }}
{% else %}
{{ linkedStartDate | date("YYYY-MM-DD") }}
{% endif %}
{% else %}
{{ linkedStartDate | date("YYYY-MM-DD") }}
{% endif %}  
David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 21, 2025

No problem @Joseph HANI !

I have posted the solution in a topmost reply so you can "accept" it.

0 votes
Derek Fields _RightStar_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 14, 2025

@Joseph HANI 

JMWE has a Nunjucks filter called date that has a number of different features. The following adds 1 day to the due date and returns it as a date object. 

 {{ issue.fields["Due date"] | date("add", 1, "days" ) | date }}

Does that help?

Joseph HANI
Contributor
February 17, 2025

Hello Derek ! 

Not really the answer i'm looking for :/ 

This is what i'm looking for : 

Actionoriginal datenew dateshift
Issue A  Feb 1, 2025 Feb 5, 2025 +4 Days 
Linked issue B Start date  Feb 10, 2025 Feb 10, 2025 Shifter +4Days
Linked issue C Feb 18Feb 22, 2025Shifted +4 Days (also) 
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events