I have never used groovy script before so I'm really trying to understand it.
The situation is this:
There is the 'assignee to me' where I or anyone else can assignee to issue to themselfs.
What I'm trying to do is check the value of a custom field and if for example this field value is '10709' only members from the
'jira-test1-group' can assignee the issue to themselfs.
So after read some topics on this forum I believe the solution is on the groovy script. I'm right? I run this script and I got some errors.
javax.script.ScriptException: javax.script.ScriptException: groovy.lang.MissingPropertyException: No such property: issue for class: Script3
Can someone help me?
import com.atlassian.jira.issue.IssueManager import com.atlassian.jira.issue.fields.CustomField import com.atlassian.jira.ComponentManager import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.CustomFieldManager ComponentManager componentManager = ComponentManager.getInstance() CustomFieldManager customFieldManager = componentManager.getCustomFieldManager() IssueManager issueManager = componentManager.getIssueManager() CustomField srcField = customFieldManager.getCustomFieldObjects(issue).find {it.name == "customfield_11501"} def groupManager = ComponentAccessor.getGroupManager() cfwt = issue.getCustomFieldValue(sccField) if (cfwt == "10709"){ !((groupManager.isUserInGroup(issue.assignee?.name, 'jira-test1-group'))) }
Community moderators have prevented the ability to post new answers.
I suspect the problem is you are running this from admin console, where there is no issue in the context? Look at other examples to see how you can get an issue instance, or run it as a workflow function.
Try to add the following in the beginning of your script
import com.atlassian.jira.issue.Issue;
Hope that helps
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.