Forums

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

Issue Creation with a script/post function on a specific transition

DEJU ALIN MADALIN June 10, 2021

Hello,

Do you know if can be possible to be created automatically an issue (for example a Story) when Epic issue-type goes through "Analyzed" status with a script/post function?

It is needed to be implemented this on Jira Server.

Thank you !

 

Best regards, 

Alin

 

 

1 answer

1 accepted

0 votes
Answer accepted
Payne
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 10, 2021

It is possible with ScriptRunner (I see you included the Script tag in your post so you may have that app?). If so, I can share a bit about how I accomplish this.

DEJU ALIN MADALIN June 10, 2021

Hello,

Yes, we have installed Adaptavist ScriptRunner for JIRA, installed version: 6.15.0.

It would be great if you can provide me some steps.

Thank you !

 

Best regards,

Alin

Payne
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 10, 2021

So, there is a lot of extra code in my script, but here is the section where I actually create a new issue. Some imports are necessary. Check it out and let me know if you have any questions about it.

IssueService issueService = ComponentAccessor.getIssueService()
IssueInputParameters issueIP = issueService.newIssueInputParameters()
issueIP.setProjectId(projectId)
issueIP.setIssueTypeId((String)issueTypeWorkOrder)
issueIP.setSummary(summary)
issueIP.setDescription(description)
issueIP.setReporterId(parentIssue.getReporter().getUsername())
issueIP.setDueDate(dueDate)
issueIP.addCustomFieldValue(customFieldRequestType,(String)(requestTypeMap[parentRequestType]))
issueIP.addCustomFieldValue(customFieldDisableAccess,disableAccessDate)
issueIP.addCustomFieldValue(customFieldRequestedFor,parentRequestedFor)
issueIP.addCustomFieldValue(customFieldApprovers,approver,backupApprover)
issueIP.addCustomFieldValue(requestTypeDescFieldId,requestTypeDescValue)
IssueService.CreateValidationResult newIssue
newIssue = issueService.validateCreate(jiraAdminUser, issueIP);
IssueService.IssueResult iResult = issueService.create(jiraAdminUser, newIssue);

DEJU ALIN MADALIN June 15, 2021

Now it's working to create a Story automatically when the Epic goes to "Analyzed".

But the wrong part is that it always creates a Story when the transition is accessed(because it's a shared transition). 

Basically I need to be created only one "Story" on this shared transition.

Thank you !

Suggest an answer

Log in or Sign up to answer