Hi,
I'm trying to change the status of an epic with a post function in script runner.
I'm doing it in the workfow of the issues as a postfunction. I want the epic status to change and go IN PROGRESS when at least one of the epic link issue is IN PROGRESS.
I tryed many way but i can't figure how to do it since i'm not expert in scriptrunner (actualy Altlassian partner in formation)
i find this code but i donc succeed at making it executable as a postfunction...
import com.atlassian.jira.component.ComponentAccessor; import com.atlassian.jira.issue.CustomFieldManager; import com.atlassian.jira.issue.fields.CustomField; import com.atlassian.jira.issue.Issue; import com.atlassian.jira.issue.MutableIssue; import com.atlassian.jira.issue.IssueManager; import com.atlassian.jira.issue.IssueInputParameters; import com.atlassian.jira.issue.IssueInputParametersImpl; import com.atlassian.jira.bc.issue.IssueService CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager(); IssueManager issueManager = ComponentAccessor.getIssueManager(); IssueService issueService = ComponentAccessor.getComponent(IssueService); CustomField epicLinkField = customFieldManager.getCustomFieldObjectByName('Epic Link'); //hardcode lookup to issue for script console: MutableIssue issue = issueManager.getIssueObject("TEST-15"); IssueInputParameters issueInputParameters = new IssueInputParametersImpl([:]); //lookup the corresponding epic via the subtask's parent MutableIssue epic = issueManager.getIssueObject( (String)issue.getCustomFieldValue(epicLinkField) ); // 21 is the transition ID in my workflow IssueService.TransitionValidationResult validationResult = issueService.validateTransition(epic.getAssignee(), epic.id, 21 as Integer, issueInputParameters) def errorCollection = validationResult.errorCollection log.error(errorCollection) if (! errorCollection.hasAnyErrors()) { issueService.transition(epic.getAssignee(), validationResult) log.error("OK") } else { log.error("ERROR") }
Can you please give me some help ?
Thank you in advance.
Florian