Use createIssue & linkIssue together in same SIL

Avril Bower
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 27, 2016

Hello,

I have a request to create an epic template which includes stories and sub-tasks that can be used over and over again. 

Instead of cloning the structure of the template (which would require another plugin) I decided to have an Epic with a specific component that, on creation, launches a script that creates the additional needed stories and sub-tasks and and then links them to the main epic. So far my If statement and createIssue statements work without a problem but I am not sure how to include linkIssue in the same statement if the issue keys haven't yet been created in the DB. 

Code I already have that works: 

//Create new story and sub-task upon creation of new epic and link them to the epic. 


if(component == "Client Upgrade Autocreate"){
    string newTaskKeyFr = createIssue("ABT", "", "Story", "Summary for first story");
    %newTaskKeyFr%.description = "Description for the new story";
    %newTaskKeyFr%.component = "Test";
    linkIssue(parentIssueKey, newTaskkeyFR, "depends on");
    
	string newTaskKeySc = createIssue("ABT", "", "Story", "Summary for second story");
    %newTaskKeySc%.description = "Description for the second new story";
    %newTaskKeySc%.component = "Test";
    
	string newTaskKeySbOne = createIssue("ABT", "", "Sub-task", "Summary for First Sub-task");
    %newTaskKeySbOne%.description = "Description for the first sub-task";
    %newTaskKeySbOne%.component = "Test";
}

Can someone help me out on how to include the linkIssue in the above code. It seems like it should be fairly simple but I can't make sense of it. 

https://confluence.kepler-rominfo.com/display/JJUP14/linkIssue

Thank you, 

 

Avril 

1 answer

1 accepted

4 votes
Answer accepted
Błażej O_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 27, 2016

Hi,

 

First thing first, you're using outdated documentation. Use this one instead:

https://confluence.kepler-rominfo.com/display/SIL30/linkIssue

 

Now to the point.

If I understand correctly, you want to launch a post-function on creation of Epic and this function should create two stories and one sub-task, and then link them all to your Epic?

 

Try something like this:

string epicKey = key;
if(component == "Client Upgrade Autocreate"){

    string newTaskKeyFr = createIssue("ABT", "", "Story", "Summary for first story");
    %newTaskKeyFr%.description = "Description for the new story";
    %newTaskKeyFr%.component = "Test";
    linkIssue(epicKey, newTaskkeyFR, "depends on");
    
    string newTaskKeySc = createIssue("ABT", "", "Story", "Summary for second story");
    %newTaskKeySc%.description = "Description for the second new story";
    %newTaskKeySc%.component = "Test";
	linkIssue(epicKey, newTaskkeySc, "depends on");
    
    string newTaskKeySbOne = createIssue("ABT", newTaskKeySc, "Sub-task", "Summary for First Sub-task");
    %newTaskKeySbOne%.description = "Description for the first sub-task";
    %newTaskKeySbOne%.component = "Test";
	linkIssue(epicKey, newTaskKeySbOne, "depends on");
}

 

Remember one important thing: when you will be adding the post-function to the Epic create transition, position it AFTER the "Creates the issue originally" action. This is because the EPIC has to be created first, before it can be linked to.

 

Second thing: above script creates "classic" links. If you want to create Epic Link instead, I think you might have to use JJupin Agile.

Michael Partyka
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 27, 2016

Blazej I wouldn't describe it better! Good job.

Avril Bower
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 27, 2016

Hi Blazej,

That fixed the issue and thanks also for the JJupin Agile tip. I hadn't even thought about it as requirements are still coming in. 

Thank you. 

Avril 

Antoin Stanton May 17, 2016

Also Ms Bower, when using the linkIssue routine, be sure to use the link name, not the outward or inward issue link value.

See the following question: https://answers.atlassian.com/questions/301971

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events