Setting Epic Link with SIL Script

Kenneth Breslow June 28, 2016

I was wondering if it's possible to set an Epic Link through a SIL Script. Right now I have a script that's attached to the create transition of a workflow specifically for Epics. What I want to do is, when I create an epic, I enter all of the important information, and when I click create, not only is the epic created, but a specific number of tasks are created as well (Specified on the create screen of the epic) that are automatically populated with all of the epic's field values and linked to the epic. I tried setting it like a normal SIL custom field set (customfield_10006 = "PACK-80" and "Epic Link" = "PACK-80") but neither work. Take a look through this script, I'm attempting to set the Epic Link through the customfields[] array being used in the createIssue routine at the bottom.

 

if(issueType == "Epic" && project == "PACK") {
 string[] packTypes = customfield_13200; //load all specified packaging types into an array
 number packTypeNum = arraySize(packTypes); //count the array to see how many epic tasks we need to generate
 string epicKey = key;
 string brand = customfield_12300;
 string customer = customfield_12402;
 string supplier = customfield_12400;
  
for(number count = 0; count < packTypeNum; count = count + 1) { //generate all packaging type issues (tasks)
    //define the required parameter values
    string projectKey = "PACK";
    string parentIssueKey = "";
    string issueType = "Task";
    string issueSummary = summary + " " + packTypes[count];
    string issueDescription = description;
    string[] customfields;
    customfields[0] = "Epic Link";
    customfields[1] = epicKey;
    string[] componentsArray = components;
    //create the issue with the original summary + the packaging type
    createIssue(projectKey, parentIssueKey, issueType, issueSummary, "", issueDescription, componentsArray, (date)"", (interval)"", "", customfields);  
    }
}

1 answer

1 accepted

0 votes
Answer accepted
Silviu Burcea
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.
June 28, 2016

You will need JJupin Agile for that. You need to save the created issue's key in a variable and then set the epic link:

//create the issue with the original summary + the packaging type
string createdKey = createIssue(projectKey, parentIssueKey, issueType, issueSummary, "", issueDescription, componentsArray, (date)"", (interval)"", "", customfields); 
#{createdKey.Epic Link} = epicKey;

See more at https://confluence.kepler-rominfo.com/display/JJUPA30/Custom+Fields

 

Regards,

Silviu

Kenneth Breslow June 29, 2016

Hi Silviu, 

Thanks for the quick answer! Your solution didn't work, but I was able to create a second SIL Script that I attached to a post function that occurs after the one I posted above. It essentially loops through the newly created issues and assigns their epic link by using the syntax

%issue%.#{Epic Link} = epicKey;

Not sure why #{createdKey.Epic Link} didn't work, though. Regardless, thanks for the help!

Suggest an answer

Log in or Sign up to answer