Hi,
with this script i copy the value of 2 custom fields into the summary and description field of an issue. When i have this script in a workflow transission as post function it works, not when i implement it as a listener tho:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.CustomFieldManager
long CF_ID_DESCRIPTION_OF_ISSUE = 21036
long CF_ID_SUMMARY_OF_ISSUE = 21035
CustomFieldManager cfManager = ComponentAccessor.getCustomFieldManager()
CustomField descriptionOfIssueCf = cfManager.getCustomFieldObject(CF_ID_DESCRIPTION_OF_ISSUE)
CustomField summaryofIssueCf = cfManager.getCustomFieldObject(CF_ID_SUMMARY_OF_ISSUE)
String descriptionValue = issue.getDescription()
String summaryValue = issue.getSummary()
issue.setCustomFieldValue(descriptionOfIssueCf, descriptionValue)
issue.setCustomFieldValue(summaryofIssueCf, summaryValue)
thx for the help
Hi @GS1337,
The update method/process is different from post-function, below is my one of sample script which would give you some idea
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import com.atlassian.jira.issue.ModifiedValue
def changeHolder = new DefaultIssueChangeHolder();
def cfSelect = ComponentAccessor.customFieldManager.getCustomFieldObjectByName("Field name")
def value = "Some Value"
def myIssue = event.issue
String val = myIssue.getCustomFieldValue(cfSelect)
if(val){
value = value+val
cfSelect.updateValue(null, myIssue, new ModifiedValue(myIssue.getCustomFieldValue(cfSelect),value), changeHolder)
BR,
Leo
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.