Hi,
I'm trying to write a quick script that sets a custom variable called "Environment" which is a single pull-down selectable choice of the following values:
None
Dev
Test
QA
QA2
Prod
I have a Custom Listener setup as "VersionReleaseEvent and when I made my release, it does appear to be triggering my script which errors out immediately before and of my debug log statements even run.
Once a release happens, I want my custom variable "Environment" set to "Prod".
The code I've written is the following and it is erroring out on the event.issue line
import com.onresolve.jira.groovy.user.FieldBehaviours
import com.atlassian.jira.event.issue.AbstractIssueEventListener
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import org.apache.log4j.Logger
import org.apache.log4j.Level
def mylog = Logger.getLogger("PushReleaseVersionToProd")
// Set log level
mylog.setLevel(Level.DEBUG)
def issue = event.issue as Issue
def EnvFieldName = 'Environment'
mylog.debug "EnvFieldName is $EnvFieldName"
def customFieldManager = ComponentAccessor.customFieldManager
def EnvField = customFieldManager.getCustomFieldObjects(issue).findByName(EnvFieldName)
assert EnvField : "Could not find custom field with name $EnvFieldName"
mylog.debug "EnvField is $EnvField at end of script"
EnvField = "Prod"
The error log is the following:
2021-07-29 14:18:32,284 ERROR [runner.AbstractScriptListener]: *************************************************************************************
2021-07-29 14:18:32,286 ERROR [runner.AbstractScriptListener]: Script function failed on event: com.atlassian.jira.event.project.VersionReleaseEvent, file: null
groovy.lang.MissingPropertyException: No such property: issue for class: com.atlassian.jira.event.project.VersionReleaseEvent
at PushReleaseVersionToProd.run(PushReleaseVersionToProd.groovy:15)
I'd appreciate any help in trying to suss out what the issue may be.
Thanks,
Jeff
Epic links are a bit funny - they're not quite links, but logically, they are.
If you've got a script for "create issue X from Epic-123 and link X back to Epic-123", you're almost there. But replace the "link X back to Y" with "update custom field 'epic link' with the 'epic name' on Epic-123"
Hi Nic,
I appreciate the answer but I'm not sure what the script would actually be. The default scripts do not provide something that will copy a value from one field on the original (Epic) issue to the newly cloned (Story) issue with a new custom field (Epic Link) to actually create that different "link". I'm relatively new to scripting and there doesn't seem to be any provided scripts that actually do this.
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.