How to retrieve subtask from: issueFunction in addedAfterSprintStart("board name")
addedAfterSprintStart return a list of story and I want to retrieve subtask of this list.
I tried SubtaskOF is not working.
Any Idea?
Richard
Hi,
Judging by your code, it's not working because:
1) There's no changelog in Issue Created event, and thus there's not point in trying to get field values from there. Get them from the issue directly.
2) It's supposed to trigger on sub-task creation, right? If so you need to change the logic of using your issue variable, because right now it is as if you are creating a parent issue, not a sub-task.
With that in mind this should help:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.type.EventDispatchOption
def issue = event.issue
if(issue.isSubTask()){
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def parent = issue.getParentObject()
def customField = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Source of Request - JudahTest")
def cfValue = parent.getCustomFieldValue(customField)
issue.setCustomFieldValue(customField, cfValue)
ComponentAccessor.getIssueManager().updateIssue(currentUser, issue, EventDispatchOption.ISSUE_UPDATED, false)
}
Thank you for the suggestion. When we tried it out we get errors on these lines
issue.setCustomFieldValue(customField, cfValue)
ComponentAccessor.getIssueManager().updateIssue(currentUser, issue, EventDispatchOption.ISSUE_UPDATED, false)
Can not find matching method for both.
Is that because we need to define options to use setCustomFieldValue for a select list (single) field?
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.