Condition to transition on certain steps for Reporter and Developers

Rok Antolic December 10, 2015

Hello,

I have the “Verschoben” transition which has allowed all statuses to transition to this one. The thing is that I want issue reporter to only be able to transition it on two steps: “Anforderung Erstellung” and “Anforderung übergeben” and Project role Developers to be able to transition it at all times. I made the following Condition script, tried it with Custom script condition and Simple scripted condition but I cannot get it to work. What am I doing wrong?

issue.getStatusObject().getName() == "Anforderung Erstellung" && currentUser == issue.reporter
|
issue.getStatusObject().getName() == "Anforderung übergeben" && currentUser == issue.reporter
|
isUserMemberOfRole("Developers")

Cheers,

Rok

2 answers

1 accepted

1 vote
Answer accepted
Thanos Batagiannis _Adaptavist_
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.
December 11, 2015

Hey Rok

try to replace the currentUser with

def user = com.atlassian.jira.component.ComponentAccessor.getJiraAuthenticationContext().user.directoryUser

I assume you use JIRA v6.*

Please let me know if this works for you

Rok Antolic December 11, 2015

Thank you very much, I managed to get it work with: (issue.getStatusObject().getName() == "Anforderung Erstellung" && currentUser?.name==issue.reporter?.name) | (issue.getStatusObject().getName() == "Anforderung übergeben" && currentUser?.name==issue.reporter?.name) | (isUserMemberOfRole("Developers")) Cheers, Rok

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.
December 11, 2015

I'm sure you want "logical or" there - ||, rather than "bitwise or" - |

1 vote
Vasiliy Zverev
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.
December 11, 2015

Try to add brackets to each condition:

(issue.getStatusObject().getName() == "Anforderung Erstellung" && currentUser == issue.reporter)
|
(issue.getStatusObject().getName() == "Anforderung übergeben" && currentUser == issue.reporter)
|
(isUserMemberOfRole("Developers"))
Rok Antolic December 11, 2015

Thanx, tried it out, sadly still doesn't help, Reporter still sees transition on steps that come after "Anforderung Erstellung" and "Anforderung übergeben". Could it be that my transition permission or general permission scheme is messing that up? Or am i missing maybe some imports in my script?

Thanos Batagiannis _Adaptavist_
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.
December 11, 2015

Hi Rok, could you please check and post any errors in your atlassian-jira.log ?

Rok Antolic December 11, 2015

There are no errors sadly, it accepts the code, however the reporter continues to see this transition on other steps

Rok Antolic December 11, 2015

@Thanos Batagiannis [Adaptavist], there seems to be a problem with "currentUser == issue.reporter" criteria. Because when I did some testing without it, everything works fine: issue.getStatusObject().getName() == "Anforderung Erstellung" && isUserMemberOfRole("Developers") | issue.getStatusObject().getName() == "Anforderung übergeben" && isUserMemberOfRole("Developers") Cheers, Rok

Rok Antolic December 11, 2015

Now it works: (issue.getStatusObject().getName() == "Anforderung Erstellung" && currentUser?.name==issue.reporter?.name) | (issue.getStatusObject().getName() == "Anforderung übergeben" && currentUser?.name==issue.reporter?.name) | (isUserMemberOfRole("Developers")) Problem was the whole time in "currentUser == issue.reporter". Tnank you guys for trying to help. Cheers, Rok

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events