Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Using plusWeeks() and nextDayOfWeek(" ") in one arguement

Chris M_ September 2, 2024

Hello everyone,

I want to calculate a field using automation. Starting from the start date, I want to calculate 20 weeks into the future and if it is not a Monday, I want to use the next Monday. Atlassian has introduced the two commands mentioned above, but it seems that they cannot be used in one command. I have tried the following so far:

 

direkt way: 

{{issue.start Date.plusWeeks(20).withNextDayOfWeek("TUE")}}

{{issue.start Date.withNextDayOfWeek("TUE").plusWeeks(20)}}

 

and indirekt way:

Create variable: 

Var: {{varPlusWeek}} which has the following smart value included: {{issue.start Date.plusWeeks(20)}}

And in the next step with extention: 

{{varPlusWeek.withNextDayOfWeek("TUE")}}

But nothing has worked. Is it simply not possible, e.g. due to the format or other reasons, or am I making a mistake here? Thank you very much.

 

Best regards

 

Chris

1 answer

1 accepted

2 votes
Answer accepted
Gaurav
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 2, 2024

Hello @Chris M_ 

Welcome to the community!!

I have gone through the post and in my understanding, you intend to add 20 weeks from the date of creation. If that is the case, please try the below operation:
{{issue.created.plusWeeks(20).withNextDayOfWeek("TUE")}}

I have replaced 'start Date' with 'created' which is the smart value to fetch the created date of a ticket.

Please feel free to share your thoughts and feedback on this, including if there is any other usage.

-GG

Chris M_ September 2, 2024

Hello @Gaurav

thank you for posting your suggestion. But I realy mean issue.start date. It's a field of Jira by default oder of tempo. Process: The ticket is created in the past. After a while the project lead negotiated the final project start with our customers (start date) and has also to enter the due date manually with the constraints mentioned above. Due to Jiras ability to calculate dates I will calculate the due date automatically.

But I do not understand which Jira has problems with the expression of plusWeeks.withNextDayOfWeek.

Thank you in advance.

 

Chris

Gaurav
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 2, 2024

Thanks for sharing the context @Chris M_ 

Please see if the below calculation helps:
{{issue.Start date.plusWeeks(20).withNextDayOfWeek("TUE")}}

Like Steffen Opel _Utoolity_ likes this
Chris M_ September 2, 2024

Thanks for your help @Gaurav!

Now, it works!!! :) But I don't understand why. I can also use start Date for a single calculation but if I use it for a chain the is no result. With your help I used Start date and now it is possible to calculate the result.

jira 3.pngjira 1.pngjira 2.png

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 13, 2024

Hi @Chris M_ 

The reasons some of your early attempts did not work could be...

Smart values are name, spacing, and case-sensitive, and you were using the incorrect case for the field.  To learn the correct smart values for a field, please use this how-to article: https://support.atlassian.com/cloud-automation/docs/find-the-smart-value-for-a-field/

Variables are text.  When you want to use a date saved as text, it must be converted to a "date type" using toDate: https://support.atlassian.com/cloud-automation/docs/examples-of-using-smart-values-with-dates/#Converting-text-to-dates

Kind regards,
Bill

Like Steffen Opel _Utoolity_ likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events