Hi,
i'm trying to put a script with script-runner to make a validator in a transition and it's look like:
import com.atlassian.jira.component.ComponentAccessor
def groupManager = ComponentAccessor.getGroupManager()
(
groupManager.isUserInGroup(issue.reporter?.name, 'group1') ||
groupManager.isUserInGroup(issue.reporter?.name, 'group2') ||
groupManager.isUserInGroup(issue.reporter?.name, 'group3')
)
I want to all the users in those groups to be able to create an issue using a specific issue type and if it's not true an error message must be shown.
Thanks in adavance.
Hi
when you set up a validator with scriptrunner you have a form field to enter an error message.
this is shown against a selected field of your condition is false
Hi,
thanks for your answer.
Yep i have already entered the error message and it works but the issue that i have is the error message is shown for the users contained in the 'group3' and it's aginst the condition in this script.
I don't know the reason why and i think maybe i have an error or something wrong .
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I guess those aren't the real group names - typo? I get blind to looking at my own code for too long and often miss the obvious.
is that your complete code block?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
those aren't the real group names for surebut i have putted 3 different groups.
yeah ths is the complete code block.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
There is nothing wrong with the syntax of the checking as you can see for yourself.
option is to get group objects to check if there's an issue with that.
groupManager.getGroup('group3')
this will return null is there's an issue accessing that group
try logging it
log.debug "group3" + groupManager.getGroup('group3')
All I can suggest
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
that returns a null when logging that line.
I don't know whay to do but i will try to follow everything from the beginning i think that something escapes me.
Thanks a lot for the time and the effort.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.