Hi all,
I have a project where there are multiple workflows - I want to merge them into a single workflow as they are essentially the same except for a single thing, and currently I have to update them all each time there are changes.
On creation of an issue, there is a validator on one version that is:
Date Expression Compare (JSU)
This workflow is specific to an issue type, so what I am after is a way to say:
I can see the argument for doing it as a condition, the trouble is that a condition can't be applied to create transition, and doing it at the next transition causes problems with issues that return to the start of the flow (ie it will no longer be 3 days).
We have these installed that might be relevant:
Scriptrunner (though prefer not to do it via this, theres talk of it being removed
You can indeed use JMWE's Scripted (Groovy) Validator together with JMWE's simplified API:
issue.getAsString("issuetype") == "Urgent" || issue.get("Requested Window Start") >= new Date() + 3
which means "issue is of issue type Urgent OR Requested Window Start is more than 3 days from now" which means that the validator will succeed if the issue is Urgent, or else if its Requested Window Start is more than 3 days from now.
I'll test that shortly, thanks a lot
Just one question though, does that include the time part?
I could probably get away with it if it doesn't, but best if it does
edit: It does indeed, thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, sorry, forgot to mention it. It does indeed.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Apologies for coming back to you and I hope you see this
If I want to do one based on time (so say "must be over X hours in future" instead of days, how does that work? I assume the date() needs changing, but I can't seem to find a list of acceptable...classes?
I did wonder about using 0.1666 of a day but I'm guessing that isnt the way!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
To add something else than days to a date, you can use this:
use(groovy.time.TimeCategory) {
return issue.getAsString("issuetype") == "Urgent" || issue.get("Requested Window Start") >= new Date() + 5.hours
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I know JSU has "preconditions" implemented but it only works for postfunction so you can't use it. I didn't use JMWE for a long time but it looks like you can use scripted validators https://innovalog.atlassian.net/wiki/spaces/JMWE/pages/72089757/Use+cases+for+validators#[hardBreak]Scripted-(Groovy)-validator
I think it can be the best way for you to achieve your goal without scriptrunner.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.