Hi,
can some one help on how to get list of associated issues (i,e Issues in Epic) for an EPIC Issue Type using a groovy script?
From the associated issues list, I would like to check issue type of the "associated issues" using groovy script and need to update the specific custom field value, when a specific issue type = CIL in my post function.
Is the below code snippet can be used to get the "Issue in Epic", but I am not sure what is the value should be used for "<Name of Link>"
for "Issues in Epic" unlike Blocks/Cloners, etc as it will not be defined as part of the "Issue linking". Please advice.
def issueLinkManager = ComponentAccessor.getIssueLinkManager()
def greatestDate;
issueLinkManager.getOutwardLinks(issue.id).each {issueLink ->
def linkedIssue = issueLink.destinationObject
}
}
Please suggest how to get this in groovy script.
All,
Please find the working script to get the list of associated issues (i,e Issues in Epic) for a EPIC issue Type.
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.Issue import com.atlassian.jira.issue.MutableIssue import com.atlassian.jira.issue.CustomFieldManager import com.atlassian.jira.issue.fields.CustomField def issueLinkManager = ComponentAccessor.getIssueLinkManager() CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager() MutableIssue epicLink = issue.getCustomFieldValue(customFieldManager.getCustomFieldObjectByName("Epic Link")) as MutableIssue; final Collection<Issue> issuesInEpic = new ArrayList<Issue>(); if(epicLink.issueType.name=="Epic") { issueLinkManager.getOutwardLinks(epicLink.id).each {issueLink -> if (issueLink.issueLinkType.name == "Epic-Story Link") { Issue linkedIssue = issueLink.destinationObject //you can validate if any other specific issue type check is required if(linkedIssue.issueType.name == "Development Ready for Check-in"){ issuesInEpic.add(linkedIssue) log.info(linkedIssue) } } } }
Hello, maybe this discussion can help you :
https://answers.atlassian.com/questions/15699065
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Quentin for the related link shared.
Using getIssuesInEpic() function shared in the related Atlassian links, was trying to copy EPIC's one of the custom field value i,e "SDD Doc Version Committed in Sprint" to custom field (i,e SDD Doc Version Committed in CIL Sprint) value of associated issues (i,e Issues in Epic) of Issue Type = CIL using the below groovy script.
I am not getting what is the correct way of using Issue = getIssuesInEpic(epicLink) API.
Please advice on how to use getIssuesInEpic to get all the associated issues and check their respective issueType to perform setCustomFieldValue() based on my above requirement shared in my post function.
import com.atlassian.jira.issue.CustomFieldManager import com.atlassian.jira.issue.Issue import com.atlassian.jira.issue.MutableIssue import com.atlassian.jira.issue.fields.CustomField import com.atlassian.jira.component.ComponentAccessor MutableIssue epicLink = issue.getCustomFieldValue(customFieldManager.getCustomFieldObjectByName("Epic Link")) as MutableIssue; Issue = getIssuesInEpic(epicLink) if(Issue.issueType.name=="CIL") { def SprintversionUpdated = epicLink.getCustomFieldValue(ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("SDD Doc Version Committed in Sprint")); CustomField Versions = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("SDD Doc Version Committed in CIL Sprint"); Issue.setCustomFieldValue(Versions,SprintversionUpdated) }
I was referring to the below EpicLinkManager's getIssuesInEpic shared in our Atlassian answers to get my script done...
Probably I need to use the EpicLinkManager's getIssuesInEpic https://docs.atlassian.com/greenhopper/6.3.9.2/com/atlassian/greenhopper/manager/issuelink/EpicLinkManager.html#getIssuesInEpic(com.atlassian.jira.issue.Issue)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Adam Markham [Adaptavist]
I am trying to add you in this answer chain as we have done similar script to set the ITG-IN due date value of an EPIC into associated issues ITG-IN due date long back.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Apologies that I didn't get round to answering this. It sounds like you have a working script now. I've upvoted your answer too.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.