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
Next: Root
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
Can anyone advice me on how I can use ScriptRunner's built-in script to make it so that:
I have a scripted Behaviour already, but want to enforce it with a validator to make sure no one else accidentally get to create a Bug ticket (per guidance from here: https://docs.adaptavist.com/sr4js/6.33.0/features/behaviours/behaviours-examples/restricting-issue-types)
All other documentations on the ScriptRunner KB doesn't cover this specific scenarios. Any thoughts would be appreciate it. Thank you!
A "simple scripted validator" on your create transition can accomplish that.
import com.atlassian.jira.component.ComponentAccessor
ComponentAccessor.groupManager.isUserInGroup(currentUser, 'Security')
Note: currentUser is already defined in a simple scripted validator.
And the last line will return true/false. If it returns false, the validator fails and the message you specify in the "Error Message" field will be displayed.
Hi Peter. Thanks for providing an insight on this. Is it possible for the script to only conditionally target a specific issue type?
Basically, I have 1 workflow behind 2 issue types (Say Bug and Task) and I only want this logic to apply to issue type Bug, and Task remains open for anyone to use.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
sure... that's quite simple:
import com.atlassian.jira.component.ComponentAccessor
def restrictedIssueTypes = ['Bug', 'Defect']
if(!restrictedIssueTypes.contains(issue.issueType.name)){
return true
}
ComponentAccessor.groupManager.isUserInGroup(currentUser, 'Security')
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.