Hi
Epic-1 -->task1–>Subtask1
in the above with the help of script runner, i am cloning the subtask1 and creating a new task task2 in one of the transitions.
For the task2 i want to set the epiclink as epic1.
Could anyone help me with the script in the subtask transition .
Thanks,
Syed
Hi Syed,
You could use the Clones an Issue and Links post function provided by Script Runner with the code shown below in the additional issue actions box and the configuration shown in the screenshot below.
// Required Imports import com.atlassian.jira.component.ComponentAccessor; import com.atlassian.jira.issue.fields.CustomField; import com.atlassian.jira.issue.Issue; // Get a reference to the Epic Link Field CustomField epicLink = customFieldManager.getCustomFieldObjectByName('Epic Link'); // Get the Epic Issue so that the cloned issue is added to the Epic Issue epic = ComponentAccessor.getIssueManager().getIssueObject("KDP-23") // If the Epic issue is a valid issue then add the cloned issue to the epic. if(epic) { issue.summary = 'Task 2' issue.setCustomFieldValue(epicLink, epic); }
image2016-1-25 13:14:6.png
As long as the epic issue object specified represents an Epic issue type then the cloned issue will be added to the epic.
This was configured using JIRA 6.4.12 and Script Runner 4.1.3.4.
I hope this helps.
Thanks
Kristian
Hi Kristian,
A bit late to the party but I have the same requirement as OP.
Your solution may work in one case but doesn't that mean hardcoding the Epic inside the script? Is there a way to:
1. Use Clone an Issue and Links on Epic 1 Issue
2. Have it create Task 1
3. Have Task 1 be in Epic 1 with an Epic Link (using a script in the Clone an Issue and Links)
Hardcoding the Epic ID inside the script is not really a fair solution. This needs to scale and work on any Epic that does this transition.
Thanks,
Ovidiu.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ovidu,
My example above was a simple example of how to set an epic link.
The script could be modified to get all epics for a project if required and if you look at other answers on Atlassian Community then you should be able to find an example of how to do this.
Thanks
Kristian
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.