Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Create project by scriptrunner

Emanuel Paquetelima
November 27, 2020

Hello ,
I would like to be able to create jira projects with existing templates through a script.
Procedure:
1. Through the transition of a card on the board, you must create a project.
2. Projects must be created using pre-created templates in JIra.
3. For example, from a card with the id, name, type of project and scrum master the project must be created.
4. There must be a condition to compare if the card has a waterfall type field, for example, a project must be created through the waterfall template.
5. If it is Agile, a project must be created using the Agile template.

Can you help me with this?
Thank in advance,
BR

1 answer

Suggest an answer

Log in or Sign up to answer
0 votes
Tarun Sapra
Community Champion
July 3, 2018

Hello @Elena Oleksenko

Is your Feature linked to an Epic via normal issue linking or via Epic link, because in that case an feature can be linked to not more than one epic.

Tarun Sapra
Community Champion
July 3, 2018

Could you also may be try to execute the code with proper logging in the script console and use "IssueManager" to fetch the issueKey of an feature and see the output based on the above code if you get desired output or not.

Elena Oleksenko
Contributor
July 3, 2018

Hi @Tarun Sapra!

Feature is linked to an Epic via normal issue linking, with "Relates to" link type. 

The problem is that Feature can be linked to another Feature with "Relates to" link type. And in this case the script will count "Done Story Points" both from Epics and from the second Feature. But I need values only from Epics. 

Tarun Sapra
Community Champion
July 3, 2018

Could you try this code in script console and see if it returns expected result for the feature issue

You can use the following code to to get issue object

def issue = ComponentAccessor.issueManager.getIssueObject("<issue-key">)

issueLinkManager.getOutwardLinks(issue.id)?.each {issueLink ->;
def linkedIssue = issueLink.destinationObject
String issueType = issueLink.destinationObject.getIssueType().toString()

if (issueLink.issueLinkType.name == "Relates") {
if (issueType == "Epic"){
int spValue = (int) (issueLink.destinationObject.getCustomFieldValue(DoneSpField) ?: 0)

totalSP = spValue + totalSP;
}
}
}

return totalSP

 

And for getting issueType use

getIssueType().getName() instead of toString()

 

Using the above approach you can isolate the problem and just test the code for an actual feature in the script console and see if it returns story points sum only from the linked epics and not from linked features. The hardcoded issue-key should be from an feature.

Elena Oleksenko
Contributor
July 4, 2018

Thank you @Tarun Sapra! Will try this

Tarun Sapra
Community Champion
July 5, 2018

Hello @Elena Oleksenko

Did you try it, what was the outcome?

TAGS
AUG Leaders

Atlassian Community Events