Hello,
I am trying to create recurring issues that are using scheduled rules. So these will get created monthly, yearly, quarterly, or weekly depending on a field that I called"monthly", "yearly", "quarterly", or "weekly".
If I'm working on the "Yearly" rule, how do I use automation to assign the due date to be the first day of the following year? I am having trouble with the JSON. So the creation date will be 1/1/2024 and the due date should be 1/1/2024.
This is what I have below.
Hi @Mary Kasinger -- Welcome to the Atlassian Community!
There are built-in date-time functions that could help do that: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-date-and-time/
For example using plusYears() and dayOfYear() you could adjust {{now}} to the first of the next year with:
{{now.plusYears(1).dayOfYear(1)}}
Please consider also examining the time adjustments if that is relevant for your use case.
Kind regards,
Bill
Hi Bill,
Sorry for the late reply, and thanks for your answer!
I ran this task to test it out, and it failed. Attached is a screenshot with my current automation - do you think there is something incorrectly set up on my end? You'll see I have the smart value entered in the "Advanced branching" condition.
I am trying to schedule this to have a due date on the first of every year, and I want this to be also run on the first of every year. I want to do this for my monthly and weekly reports as well, but I figured if I can get the yearly one set up then I can figure out the other ones.
I so appreciate any help and your help so far
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi!
My understanding was you were trying to set the Due Date for specific time frames, and so...there should not be a need for an advanced branch in the rule.
So the question is: when/under what conditions do you want to create these issues and set the Due Date?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks, Bill! I was able to create and run the automation to set up the correct due date. I'm now having trouble with duplication of these issues (see below screenshot of scheduled issue followed by the setup behind the action).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, Mary.
Would you please explain which issues are being duplicated?
And, please post an image of the audit log, expanding the details to show for the different rule runs which you believe are causing duplication. Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI Bill,
Yes, I have a JQL in the scheduled section of the automation rule that is scheduling a weekly run every Monday for every issue in the search that has a frequency = "weekly" (see below screenshot of the first part of the automation I didn't include previously). I hope this is what you need, if not let me know! Thanks so much.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks, and that helps.
The JQL for that trigger will return *all issues* which have frequency = Weekly. As you are running this rule once a week, the number of issues it finds will increase by one each week.
I am guessing you only want to copy the fields from one, example issue instead. Does that sound correct? If so, you could change your rule to only use the most recent issue as a template, like this:
project = myProjectName AND frequency = Weekly ORDER BY Key DESC
{{lookupIssues.first.summary}}
And use that same pattern to set the other fields.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Bill,
You are correct in what I want to do, which is copy the fields from one existing issue instead. I'm glad my screenshot helped.
I so appreciate you being patient with me. Thanks again.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The Lookup Issues action accepts your JQL and then returns a set of issues, like this:
You may then access the fields of the returned issues to create your new issue, as shown below. I recommend specifically selecting your project and issue type using this approach.
The complete rule would look like the one below, including an Advanced Compare Condition to handle the case of no existing issues found.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Bill,
Thanks for the detailed response. I am able to grasp and setup these steps based on your screenshot, but I am still not grasping the "create issue" portion. Do I need to define any the fields in my current issues further? here is my screenshot of what I have set up now.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Smart values are name, spacing, and case-sensitive...including the built-in ones.
And I noticed you have the case incorrect for the lookup ones, which would return empty values. Please try following this template, noting that lookup is lowercase and Issues is uppercase:
{{lookupIssues.first.summary}}
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.
After the change, did the issue create work as you expected?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I clicked on "run rule" about 20 minutes ago, still nothing. I will let you know.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That should run it immediately...unless the trigger has JQL (which I believe you removed).
What does the audit log show now?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ah, I will look at this log moving forward. I am getting some errors (see below). Not sure what the error "project or issue type not set", but no new issues have been created. I did run it just now, apparently it didn't run the first time. Still no new issues.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yup...there are no issues from the trigger...from which to copy the project or type.
In your issue create, if you select the project and issue type from the dropdowns the error will be fixed.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Oh, I see. Now, I chose the project and issue type from the dropdowns and ran the rule with some errors. It cannot find the assignee. I tried 3 different ones - copy from issue, parent, and trigger issue.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Progress! Okay, for the assignee you can use the same technique with lookup issues, if you want the same person assigned:
{{lookupIssues.first.assignee.accountId}}
If instead you want someone specific, or to use round-robin, etc., you can do this:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It was a success in the audit log, but it only created one of the weekly issues instead of the other ones in the lookup array (if that makes sense) see below screenshot. And thank you!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Mary, I think I missed something from the beginning of your scenario...I thought you were adding a single weekly issue, for each week.
Do you instead want to add several different issues, which re-occur for each week?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Bill, perhaps I am the one who misunderstood. Yes, I do want to create and add an issue for every issue that has frequency = "weekly", and re-occur each week. I also have monthly and yearly issues that I will use the same automation setup for. The original scenario was working but duplicated the issue creation because every week more would be added, so it was copying every single issue existing. I would want the original to be copied, or the most recently created issue with frequency = "weekly" to be added on a recurring basis each week.
Sorry about the confusion.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
A key question is: do the weekly issues finish during each week?
If so, you can probably use a JQL statement to find the issues, iterate over them with either a scheduled trigger or branch on JQL, and create (or clone) to new issues.
If they do not finish during each week, you will need a way to create the set of issues, regardless of any existing "weekly" issues...
project = myProjectName and frequency = Weekly AND created >= {{now.toStartOfDay.minusDays(7)
I suggest trying that JQL with advanced issue search to see manually to see if it works for you. When used stand-alone, you would need to enter the date/time manually.
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.