I'm trying to develop a method of using a recurring issue type in Jira, I have built a simple workflow in Jira and associated it to the issue type "Recurring task"
The workflow is simple:
Open -> Active <-> Inactive -> Closed(permanetly)
I also have 3 customfields i would like to use:
1. Frequency - Select list - ("Daily(1d)", "Weekly(7d)", "Biweekly(14d)", "Monthly(30d)", "Quarterly(90d)", "Annually(365d)")
2. Lead time reqirement - Select list - ("None", "1 day", "2 days", "3 days", "7 days", "14 days", "30 days", "60 days", "90 days")
3. Calendar Due date - Date picker - Default value of CurrentDate
Firstly I require some method to do an "Auto-Transition" (From in-active -> active, when a condition is met:
Condition: when (due date + frequency) = new due date
So basically it must have the inital date when created + the frequency date(eg,1d-365d) then that should then become the new date and basically replace the initial due date <- this should only be relevant on in the in-active status
So what I would like out of this is that once a new dute has been automatically transitions from in-active to active only.
For active to in-active that must be set manually on the task is completed.
Can anyone give advice or guidence?
Community moderators have prevented the ability to post new answers.
Regarding your question in the comment on having a transition available after some days, you could try this as a Script Runner scripted condition:
import com.atlassian.jira.component.ComponentAccessor def changedDate int numDays = 3 def now = new Date() def changeItems = ComponentAccessor.getChangeHistoryManager().getChangeItemsForField(issue, 'status') if (changeItems.size()>0) { changedDate = changeItems.sort{it.getCreated()}.last().getCreated() } else { changedDate = issue.getCreated() } return (changedDate + numDays < now)
This tests if the last change of the status (the last transition) plus a number of days (here 3) is before the current date and time. If this is true, the condition evaluates to true and the transition is available (if all other conditions are true...)
Henning
Thank you, will give it a try as soon as i can
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Upvoted, but I think you need to back this up with something else so the users understand why they can't do the transition. The "something else" could be eg a scripted field, or the intenso conditions validator.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jamie, Your Escalation Service/script is excellent and works well. Thank you!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You could implement this as a Script Runner service which runs once a day to test if the condition is meet and transition the matching issues. For more specific advice or guidance we need more specific info where you're stuck :-)
Henning
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
a service that runs once a day would work. What specific info do you need?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If this is enough, I'm fine :-) Implementing a Groovy service is already provided by Script Runner, look here, there are also some good examples.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Could you give some guidence of what the code should look like for the service?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You don't have to provide some "special" code to create a service. It's a normal Groovy script implementing your logic and actions. You save this script to a folder on the server, install a Script Runner service within JIRA and define the path to the script and the intervall, how often the script should run.
Within the script you first have to find the issue you want to transition. You should narrow down the list of possible issues as much as possible through a JQL search. Example code see here.
I think, from your description above, for the resulting issue you have to calculate if they are due by reading the two fields Due Date (through issue.getDueDate()) and Frequency. Pay attention, that the value of a select list is an Option and you have to call getValue() on the Option to get the real value. See here for examples on reading customfields.
For the last matching issues you have to transition them as described here.
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.
The thing I was talking about it is available now... kind of beta though: https://jamieechlin.atlassian.net/wiki/display/GRV/Escalation+Service
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Henning,
Our Workflow basically closes a subtask then transitions the main task into "Monitor & Close"(Status) and needs to continue to be open for x days(must be vaiable or perhaps pre-defined) then the option to be closed should become available?
is this possible and how?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, you can script a condition for the workflow button depending on a date.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jamie,
Any further progress on your escalation service?
Do you know what would be the simplest way to implement the an workflow transition button on an issue remains hidden until X days have past?
So therefore i would like the option for issues to be manually be closed, but only after x amount of days?
Thanks in Advance
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Week or so.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ah i see, When do you expect your escalation service to be ready?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
And as Henning says, it needs to be a service, not post-function or anything else.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No, I abhor jelly. It will be similar to what Henning descibes below. You specify a jql query, a frequency, issue action(s) for matching issues, and optionally additional code to run, such as update custom fields or whatever. The idea is it would be used instead of "jelly escalation".
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
My thought was to write a groovy post-function, but not sure how and where to use it. I thought of fast-track but it requires and action to be automated, whereas i would like something to do the auto-transition automatically? can you describe your "escalation service" ,How will it work in this situation? will it auto-transition based on a condition? we don't want to use jelly scripts - will this included jelly scripts?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The bits of code you need are around, eg IssueService, run a jql query. Can you be more specific?
I'm currently working on a configurable "escalation service", which will probably be able to do what you need with minimal code, you might just want to wait for that.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Community moderators have prevented the ability to post new answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.