Setting Epic Link with SIL Script

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

This widget could not be displayed.

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

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
Community showcase
Posted Tuesday in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

171 views 1 3
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you