How to edit Version Details using script runner

Paz Grimberg August 7, 2017

Hi,

Following script works fine from script console but doesnt work when i use it in script listener:


def user = ComponentAccessor.jiraAuthenticationContext.getLoggedInUser()
CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager();
def searchService = ComponentAccessor.getComponent(SearchService.class);
def projectManager = ComponentAccessor.getProjectManager()
VersionManager VersionManager = ComponentAccessor.getVersionManager()
def versionService = ComponentAccessor.getComponent(VersionService)

def Existing = ComponentAccessor.versionManager.allVersions.find { v ->
v.projectObject.key == "SWAINF" && v.name == "new version"
}

String VersionName =Existing.name
Date VersionStartDate = Existing.startDate
Date VersionReleaseDate = Existing.releaseDate

if(Existing){
versionService.setVersionDetails(user , Existing, "VersionName" , "VersionDescription")
log.debug("End Update Existing Version: "+ Existing)
}

 

Please Advise

Thanks

1 answer

0 votes
Jenna Davis
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 10, 2017

Hello, 

What exactly are you wanting this script to do? Can you explain the context a bit to me so I can help you figure out what is needed? Also, when are you wanting the listener to fire? 

Jenna

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events