You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
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?
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)
Rather than Validators you could have two Conditions: one for the only in group and the other for field value.
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.
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
You can't do that OOTB. Well you could use Automation to undo the transition if not allowed but that isn't very desirable.
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.