Objective: Upon VersionCreateEvent, automatically edit created Version to have the template text "Approver: ____ Tester: ____" in the Version Description.
This should be so simple, and I'm clearly missing something. When a version is created for the "TST" project, I want to update the Version Description text to "Approver: ____ Tester: ____". I am looking to use a Listener, although if there's a better way I'm open to it.
I started with the Create a New Fix Version of the Selected Project from Adaptivist Library, as well as the editVersionDetails method from the VersionManager of the API reference. Looking to cobble it together, I have the very basic (and very non-compiling) Listener of:
import com.atlassian.jira.component.ComponentAccessor
// the key of the project under which the version will be edited
final String projectKey = "TST"
// the name of the version just created, also incorrect
final String versionName = $createdVersion
// a description for the new version
final String reldesc = "Approver: _____ Tester: _____ "
ComponentAccessor.versionManager.editVersionDetails($createdVersion, ????, reldesc)
1) How do I get the id of the Version that was created with the event I'm listening for/to? And then insert that as the Version to be updated with editVersionDetails?
2) None of the content I've put in the parenthesis for editVersionDetails has worked, I always get an error. Even when hardcoding an existing Version ID and an existing Version Name like so:
ComponentAccessor.versionManager.editVersionDetails(80641, VB1, "Approver: ____ Tester: _____")
I get this error result
groovy.lang.MissingPropertyException: No such property: VB1 for class: Script1402 at Script1402.run(Script1402.groovy:3)