Simple scripted condition in groovy. ScriptRunner.

Kate September 11, 2013

Hi!

How can I say this simple scripted condition: previous issuetype was "Bug", current issuetype is "New Feature" in groovy?

2 answers

1 accepted

0 votes
Answer accepted
DanielG
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 12, 2013

Another solution.

You can create a new Custom Field that when an issue changes from 'Bug' to 'New Featura' put a value in custom field (ex. 'Yes') (you can do these with custom listener).

So, you'll have more easy to make the condition of groovy, because you've only have to check on the condition if the custom field is set to 'yes'.


Hope it helps.

Daniel

Kate September 16, 2013

Oh, I like this idea. I guess I can use it. Thanks!

0 votes
RambanamP
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 11, 2013

what is mean by previous issue type was bug and current issuetype is "New Feature" ?

do you mean issue created as bug and later moved to new feature?

or assumen current issue is TEST-12 bug and prvious issue is TEST-11 new feature, is it like this?

Kate September 11, 2013

I have builtin script listener "Fast-track transition an issue":

event: Issue Moved

condition: issuetype was Bug, and new issuetype is New Feature.

And I don't know how to say this condition in groovy.

RambanamP
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 11, 2013

i am not getting exactly what do you want achive!!

can you explain little bit more about your requirement.

check this it may help you

https://jamieechlin.atlassian.net/wiki/display/GRV/Built-In+Scripts?src=contextnavchildmode#Built-InScripts-JQLQueryCondition

Kate September 11, 2013

Issue created as bug and later moved to new feature, at this moment listener should work. Only if it was a bug and now it's a new feature.

JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 11, 2013

You'd need to run through the changehistory of the issue. Do you mean to check whether the issue type changed in this transition, or at any time previously?

Kate September 12, 2013

I mean this condition.

issue.issueTypeObject.name == "New Feature" && ??previous issuetype = Bug??

JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 12, 2013

There is sample code in the UI for priority changed - you need to modify it for issuetype. Think the string you want is "issuetype", but could be wrong.

Suggest an answer

Log in or Sign up to answer