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 :
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.
@David Fischer You are a genius man !
Thank you soooo much it is working great !! Exactly as intended !!
You have made my day !!! 🙏
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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 !
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Joseph HANI
can you share the full configuration of your event-based action?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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 %}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No problem @Joseph HANI !
I have posted the solution in a topmost reply so you can "accept" it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Derek !
Not really the answer i'm looking for :/
This is what i'm looking for :
Action | original date | new date | shift |
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 18 | Feb 22, 2025 | Shifted +4 Days (also) |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.