Hello,
Here is my scenario:
When creating an issue A, I use the "Clone an issue and links" post function on the creation transition.
This creates a clone issue, issue B, on which I make some operations through "Additional issue actions":
- Update issue B summary, issue B fixverions
- Set issue B specific custom field to a specific value
- Create links between issue B and other issues
With the script below, all the actions related to fields are working, but not the links creation.
Important thing is that the same code works in other context (basic transition for example), and that I get the summary of my issue updated with the relevant Ids of the issues I want to link issue B to:
import com.atlassian.jira.component.ComponentAccessor
def issueLinkManager = ComponentAccessor.getIssueLinkManager()
def authenticationContext = ComponentAccessor.getJiraAuthenticationContext()
issue.summary = '[DASHBOARD] ' + sourceIssue.key + ' - ' + issue.summary
issue.fixVersions = new HashSet<String>()
def cfm = ComponentAccessor.getCustomFieldManager()
// customfield_27012 = LPT - Niveau de test
def cf_LPT_NiveauTest = cfm.getCustomFieldObject("customfield_27012")
def om = ComponentAccessor.getOptionsManager()
def cfConfig = cf_LPT_NiveauTest.getRelevantConfig(issue)
def option_DashBoardEvol = om.getOptions(cfConfig).getOptionForValue("DashBoard - Evol", null)
issue.setCustomFieldValue(cf_LPT_NiveauTest, option_DashBoardEvol )
//used for debug
issue.summary = "idLPTTdb=" + sourceIssue.getKey() + " " + issue.summary
issueLinkManager.getInwardLinks(sourceIssue.getId()).each {
lpttdblink ->
if (lpttdblink.getIssueLinkType().getName().contains('Traitement BSL')) {
def idBSL = lpttdblink.getSourceObject()
//used for debug
issue.summary = "idBSL=" + idBSL.getKey() + " " + issue.summary
issueLinkManager.createIssueLink(issue.getId(), idBSL.getId(), new Long(12000), null, authenticationContext.getLoggedInUser())
idBSL.getSubTaskObjects().each {
if ((it.getIssueTypeObject().getName().contains("[BSL] Evolution")) && (it.getSummary().contains("[LPI]"))) {
//used for debug
issue.summary = "stBSL=" + it.getKey() + " " + issue.summary
issueLinkManager.createIssueLink(issue.getId(), it.getId(), new Long(12000), null, authenticationContext.getLoggedInUser())
}
}
}
}Can anyone help me on this?
Many thanks,
Best regards.