Hi,
For first look qustion is very simple, but i don't know what is going on. I have two if else in my code. Create task and update custom field from transition post function in Create. Here is a code:
def type = issue.getIssueTypeId()
// ---------- CREATE TASK -------------
if (type == "11") // tylko dla IssueType = System
{
def sum = issue.getSummary()
issueInputParameters.with {
projectId = projectManager.getProjectObjByKey("SYS").id
summary = "$sum"
issueTypeId = "12"
reporterId = user.name
}
def validationResult = issueService.validateCreate(user, issueInputParameters)
def issueResult = issueService.create(user, validationResult)
def newIssue = issueResult.getIssue()
log.debug "$newIssue"
}
else
{
log.debug "Task nie został stworzony - IssueType inny niż System"
}
// ----------UPDATE RELACYJNY CUSTOM FIELD-----------
if (type == "11")
{
def fieldToChange = "customfield_11067"
def newValueIssueKey = "SYS-15810"
def cf = customFieldManager.getCustomFieldObject(fieldToChange)
List newValue = new ArrayList()
newValue.add(newValueIssueKey)
issue.setCustomFieldValue(cf, newValue)
log.debug "test2"
}
else
{
log.debug "Custom Field Not Updated - IssueType inny niż System"
}
Where is a problem? Task is created, but in logs i have:
"Task nie został stworzony - IssueType inny niż System"
Custom field is updated, but in logs i have:
"Custom Field Not Updated - IssueType inny niż System"
I don't have test2 or $newIssue value. I think that could be very stupid mistake, but where... If works fine because Issue is created just for type == 11.