Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Post-function script results zero after creating a subtask

Rene December 5, 2019

Hi Community,

 

i've got a little problem. When transitioning an issue to a new status, we run a custom script to create subtasks based on different settings.

Creating these subtask works fine, but when i try to log the number of subtasks, I get a 0. What am i missing here?

 

issueObject.setProjectObject(issue.getProjectObject())
issueObject.setIssueTypeId(issuetypeId)
issueObject.setParentId(issue.getId())
issueObject.setSummary(summary)
issueObject.setAssigneeId(issue.getAssigneeId())
issueObject.setReporter(issue.getReporter())
issueObject.setAffectedVersions(issue.getAffectedVersions())
issueObject.setFixVersions(fixVersions)
issueObject.setDescription(issue.getDescription())
issueObject.setComponent(issue.getComponents())
issueObject.setLabels(issue.getLabels())
issueObject.setPriority(issue.getPriority())
issueObject.setCustomFieldValue(hgruppierung,issue.getCustomFieldValue(hgruppierung))
issueObject.setCustomFieldValue(hHotlinefaelle,issue.getCustomFieldValue(hHotlinefaelle))
issueObject.setCustomFieldValue(hZeitaufwand,issue.getCustomFieldValue(hZeitaufwand))

def issueManager = ComponentAccessor.getIssueManager()
def subTask = issueManager.createIssueObject(users, issueObject)
ComponentAccessor.subTaskManager.createSubTaskIssueLink(issue,subTask,ComponentAccessor.jiraAuthenticationContext.getLoggedInUser())

for(Issue iss: issue.getSubTaskObjects()) //Never enters here
{
log.info(iss.getId())
}


Thanks for your help in advance

 

Edit: Even a post function later (same transition) another script returns a 0 for the numbers of subtasks. Also reindexing does not work. Seems like all the postfunctions need to be done and some loading needs to be done. No one got an idea?

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events