Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

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 Community Leader Jun 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.

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 Community Leader Jun 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);

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
TAGS
Community showcase
Asked in Jira Service Management

JSM June ask me anything (AMA)

Hello Community members! We’re wrapping up the end of JSM June with an Ask Me Anything (AMA) with the Jira Service Management product team. This is your chance to ask all your ITSM questions to o...

270 views 13 14
View question

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you