Hello,
I'm trying to obtain the current issue in a post function groovy script. I've read many posts saying to use the following code:
def issue = issue as MutableIssue
or to use directly the property issue. Unfortunately, none of these works. In these cases I receive an error saying:
"We can't create this issue for you right now, it could be due to unsupported content you've entered into one or more of the issue fields. If this situation persists, contact your administrator as they'll be able to access more specific information in the log file."
I've looked in the log file and I've found the following error:
" ... 264 more
at fr.gfi.jira.plugins.runner.workflow.GroovyPostFunction.execute(GroovyPostFunction.java:40)
at fr.gfi.jira.plugins.runner.quercus.ScriptingManagerImpl.doExecuteScript(ScriptingManagerImpl.java:272)
at script158737377911840635318.run(script158737377911840635318.groovy:21)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:307)
at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:52)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:53)
Caused by: groovy.lang.MissingPropertyException: No such property: issue for class: script158737377911840635318"
Here is my script:
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.MutableIssue import com.atlassian.jira.issue.IssueManager import com.atlassian.jira.user.util.UserManager import com.atlassian.jira.event.type.EventDispatchOption def customFieldManager = ComponentAccessor.getCustomFieldManager() def groupManager = ComponentAccessor.getGroupManager() def issueManager = ComponentAccessor.getIssueManager() def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser() def multiGroupCf = customFieldManager.getCustomFieldObjectByName("mycustomfield") //multigroup picker custom field def group1 = groupManager.getGroup("group1") //jira group def group2 = groupManager.getGroup("group1") //jira group def group3 = groupManager.getGroup("group1") //jira group def groupList = [group1, group2, group3] def currentIssue = issue as MutableIssue currentIssue.setDescription("Some description") currentIssue.setCustomFieldValue(multiGroupCf, groupList)
Do you have any suggestions about how to access the current issue from a post function during issue creation?
Thank you.