I am using this custom post script function to - add part of text between [... ]from custom field to summary field when creating sub-taks
So if in custom field is text [ACC]-accounting, only [ACC] part is added in field summary - at the begining before text that customer has written in summary field.
How can i check if custom field is empty, and set it so that nothing is added to field summary?
This is code i am using
import com.atlassian.jira.component.ComponentAccessor;
def issueManager = ComponentAccessor.getIssueManager()
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def cField = customFieldManager.getCustomFieldObject("customfield_11201")
def cFieldValue = issue.getCustomFieldValue(cField)
def a = cFieldValue.toString()
def x = a.indexOf('[')
def y = a.indexOf(']')
def newSummary = a[x+1..y-1] + " - " + issue.summary;
issue.summary = newSummary;