Dear all,
I need help by develop a groovy Script.
I need a Script, that all from all Tickets in a Project "SWG" the Field Content from a custom multiline field attached to the system field description.
And I have no idea how can I do this. Please, can you help me?
The script should only run once a time.
Thanks in advanced
Let me see if I understand ... you wish to copy the text from a custom field and append it to the description of each issues in a project?
Something like this may work for you
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.web.bean.PagerFilter
import com.atlassian.jira.bc.issue.search.SearchService
import com.atlassian.jira.event.type.EventDispatchOption
def searchService = ComponentAccessor.getComponent(SearchService)
def issueService = ComponentAccessor.issueService
def issueManager = ComponentAccessor.issueManager
def customFieldManager = ComponentAccessor.customFieldManager
def currentUser = ComponentAccessor.jiraAuthenticationContext.loggedInUser
def jql = 'project=SWG'
def query = searchService.parseQuery(currentUser, jql).query
def cf = customFieldManager.getCustomFieldObjectsByName('name of your multiline cf')[0]
searchService.search(currentUser, query, PagerFilter.unlimitedFilter).results.each {
def issue = issueManager.getIssueObject(it.key)
def cfValue = issue.getCustomFieldValue(cf)
if(cfValue) {
def iip = issueService.newIssueInputParameters()
iip.description = issue.description + '\n\n' + cfValue
def updateValidationResult = issueService.validateUpdate(currentUser, issue.id, iip)
assert updateValidationResult.isValid()
issueService.update(currentUser, updateValidationResult, EventDispatchOption.DO_NOT_DISPATCH, false)
}
}
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.