Transition validator with a condition

Neta Knyazhansky Caspy November 21, 2023

Hello,

I'm trying to configure a validator that will check a certain field, and only if the value is x, then the transaction can be made only by members of a certain group.

I have ScripRunner & JMWE.

Can it be done?

Thanks

2 answers

1 accepted

0 votes
Answer accepted
David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 26, 2023

Hi @Neta Knyazhansky Caspy 

you can use a JMWE Build-your-own Validator with a script like:

!issue.customfield_12345 || issue.customfield_12345.value != "QA" || user.groupIds.includes("727f8cab-34e5-4cfe-ada1-b0c8452531f2")

where  customfield_12345 is the custom field ID of the "found by" field (you can find it on the "Issue Fields" help tab), assuming it's a SIngle-Select custom field, and 727f8cab-34e5-4cfe-ada1-b0c8452531f2 is the group ID (you can find it using the "Lookup group..." button in the editor toolbar)

Neta Knyazhansky Caspy November 26, 2023

@David Fischer This is working perfectly!

Thank you!

0 votes
Jack Brickey
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 21, 2023

Rather than Validators you could have two Conditions: one for the only in group and the other for field value.

2023-11-21_09-54-22.jpg

Neta Knyazhansky Caspy November 23, 2023

Hi @Jack Brickey

Thank you for taking the time to reply.

Can I make them work together?

My use case is that only the QA team will be able to close bugs that were created by them.
I have a field called "found by", so if the value there is "QA", then only member of the group can close, but otherwise, anyone can close.

Jack Brickey
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 24, 2023

Conditions are "and" in nature so if you have both then both must be true. So the logic table is like this...

QA group  Found-by-QA    >   Able to transition?

      No                 No             >            No

      No                 Yes            >            No

      Yes                No             >            No

      Yes                Yes            >            Yes

Neta Knyazhansky Caspy November 26, 2023

@Jack Brickey I need to logic table to look like this;

QA group  Found-by-QA    >   Able to transition?

      No                 No             >           Yes

      No                 Yes            >            No

      Yes                No             >            Yes

      Yes                Yes            >            Yes

Jack Brickey
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 26, 2023

You can't do that OOTB. Well you could use Automation to undo the transition if not allowed but that isn't very desirable.

Neta Knyazhansky Caspy November 26, 2023

@Jack Brickey I have ScripRunner & JMWE, can either help?

Jack Brickey
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 26, 2023

Yes, I'm sure SR can be used here but I have not personally done this. I recommend searching the community for similar, e.g. "multiple field condition transitions with Scriptrunner" or similar.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events