I need to create an automation that uses a label to create a cloned ticket with a schedule date
Asked by Sam Vanderbilt:

**My goal is to create a label than when applied will create a ticket for every Monday, Wednesday, and Friday for the next month. For testing this, my automation is only trying to create a ticket for the next monday, but the ultimate goal is for my MoWedFri label to create 12 tickets (give or take depending on the month) for each Monday, Wednesday, and Friday in a month.**

My automation is as follows so far:![Screenshot 2024-01-10 at 11.00.55?AM.png](/t5/image/serverpage/image-id/299929i41377A7956896934/image-dimensions/455x255?v=v2 "Screenshot 2024-01-10 at 11.00.55?AM.png")

The JQL logic seems to get ignored, so the ticket is cloned, but the field is not updated and the audit log will even say it's "successful" even though my definition of success is that the right date is applied.

I also tried using the logic:

{{issue.Scheduled Date Time.withNextDayOfWeek(\["MON"\])}}

which also did NOT work.

I am at a loss why this will create the clone, but not update the field "Schedule Date Time" to the value I want.


Answers:
author: Els Bassant
body: Hi Samuel,

I believe the smart value should be {{now.withNextDayOfWeek("MON")}}.

* It needs the "now" part to know where to calculate from.
* The "MON" part should be without square brackets

Hope this helps,

Els

comments: author: Sam Vanderbilt
body: Els, thank you so much. That seems to work. I had tried to use the "now" value, before so I'm sure it was the square brackets that was the issue. I used the brackets after copying them from Jira's page with instruction on this value, so I am disappointed that was the issue.

Do you have any ideas how I can make it work without "now"? We want the label to work off the date within the "Schedule Date Time" value on the issue that we are applying the label to as opposed to "now".

So when I tried: {{issue.Schedule Date Time.withNextDayOfWeek("MON")}}, it again failed to apply a date, but it did create the clone.

The image lanaguge is {{issueSchedule Date Time.withNextDayOfWeek("MON")}}, but i corrected it to {{issue.Schedule Date Time.withNextDayOfWeek("MON")}} and it still did not work.

![Screenshot 2024-01-10 at 12.22.58?PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/299947i5A9B664FA49379BE/image-size/large?v=v2&px=999 "Screenshot 2024-01-10 at 12.22.58?PM.png")![Screenshot 2024-01-10 at 12.23.26?PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/299948i0D3131BEF4F3CB37/image-size/large?v=v2&px=999 "Screenshot 2024-01-10 at 12.23.26?PM.png")


author: Els Bassant
body: Hi Samuel,

Sorry, I missed that it was based on that field. Assuming that "Scheduled Date Time" is a date field, it should work. I recommend double checking the field name and spelling.

{{issue.Schedule**d** Date Time.withNextDayOfWeek("MON")}}

You are missing the d in Scheduled.  
So your original smart value was correct save for the brackets.

Hope this helps,

Els


author: Sam Vanderbilt
body: Thank you so much for your help, this seems to have worked!

For the rest of the automation, I added: .plusDays(X) and for X I did either 7,14, and 21 so I can get a months worth built all at once. I am unsure if there's a way to build it so that I can query it to make a clone for every monday, wednesday, and friday in a month instead of just doing next monday plus days.

This will work for now, but curious if you know of any logic that would be what I posed above.

Thanks again!


Tags: cloud

jira-service-management

jira-service-management-cloud