I'm trying to write a condition that fires an event with the groovy script runner?
I need to fire an event when the due date has been updated or changed?
Is this possible?
Community moderators have prevented the ability to post new answers.
Have you looked at that - https://jamieechlin.atlassian.net/wiki/display/GRV/Built-In+Scripts#Built-InScripts-Firesaneventwhenconditionistrue
Why do you want to fire event in a condition and not post-function?
I think the "Fires an event when condition is true" post-function will work for you with the following condition
issue.dueDate != originalIssue.dueDate
My idea was to use the "Fires an event when condition is true" Script Listener?
I think "issue.dueDate != originalIssue.dueDate" is correct, however i think the syntax may be incorrect? I don't think "originalIssue" exists?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What makes you think it does not exist ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I just tried to test it in the Builtin Script Runner - Condition Tester
And i got the following result:
The result evaluated to false
Tip: If you're not getting the right result add an assert statement to the questionable line. See docs for examples (click question mark icon above).
It it is correct I will try and run it?
I copied issue Updated event? (Called it: issue Due Date Changed) When it fires the "issue Due Date Changed" event will it show whether the due date was changed? Or must this be specified somewhere?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm not sure the condition tester will work in that case as there is no real change in the due date.
Regarding the event it will show nothing just this event will be fired. What happens as a result from the event depends on how the notification scheme is configured and if there are any registered listeners for this event.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Alright, so you suggest I rather do a post-function? Or could the script listener and events do the trick?
I basically just want 2 nofitfy the project lead of due dates changes/updates?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Create a custom event and then configure the post-function to fire this event when the due date is changed (as described above).
Then configure the notification scheme of the project to notifiy the project lead when that event is fired
https://confluence.atlassian.com/display/JIRA/Adding+a+custom+event
If you want to customize the email sent when this event is fired see this article
https://docs.servicerocket.com/display/ATLASSIAN/How+to+create+a+custom+event+in+JIRA
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Great, I'll give it a try. Thanks for all your help.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Listener is probably the right way to go, but originalIssue is not available for listener - an example for listeners with a change of priority would be:
issue.priority?.name == 'Major' && changeItems.any { it.get('field')=='priority' }
so you would just need to use the due date field name: duedate
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
And Boris is right, you can't really test either of these in the condition tester, as there is no event.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI Jamie,
Thanks for your imput. I used the listener instead of the post-function, but I did use originalIssue and it seems to have worked. So I'm quite pleased.
Thanks guys for all the advice. It Works!!!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
oh yeah, it's there, my bad.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No worries :) Is there anywhere documentation to learn this Language/syntax?
Like some kind of tutorial?
E.g. issue.dueDate != originalIssue.dueDate
E.g.issue.priority?.name ==
'Major'
&& changeItems.any {
it.
get
(
'field'
)==
'priority'
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
After reading https://jamieechlin.atlassian.net/wiki/display/GRV/?
Unfort the useful docn is scattered amongst multiple pages. Then you could do some groovy tutorials to understand GDK methods like "any".
Reading https://jamieechlin.atlassian.net/wiki/display/GRV/Built-In+Scripts#Built-InScripts-Simplescriptedconditionand doing some experimentation will get you quite far. If you know java you have a big leg up.
But short answer, you just need to do the legwork. I think it's worth it, but I'm biased.
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.