Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,300,025
Community Members
 
Community Events
165
Community Groups

we have one requirement i.e
when in Parent Jira ticket which is story issue type in workflow if we click a fail transition it should create new issue type Bug. which is  completed .

but what i am looking here when new issue created which is bug(Child) the newly created child ticket summary has to be copied as a comment to parent ticket

is that possible ?

my automation plug in was expired we have JSU, Script runner and Jira Misc plugin.

1 answer

Hi @CHINNAMUTHEVISAI_SATYANARAYANASHARMA  You can do this easily with the help of JSU plugin. Use Post function >> Copy field value.
Select Issue relation Linked issue >> select the link type 
Copy field Summary to ***new comment***

Try this it should work.

 

Add comment JSU.PNG

Applied same on parent workflow but getting comment on child case.

this post function has to be applied on parent ticket or child ticket ?

Hi @CHINNAMUTHEVISAI_SATYANARAYANASHARMA  Yes, post function should be on parent issue. It seems that you selected the wrong issue link relation. Check issue link relation, select correct link type.

Thanks

transition.PNG

applied same post function on parent workflow still its not getting commented.

May I know which link type are you using when creating child bug issue ?

Select link type bug instead of Related to . 

Sorry for commenting from other account

 

That's also done before raising this ticket but not working too.

Move post function after child issue creation post function. 

Bug is a link type, right ? 

Thanks

Yes bug is a link type

I have tested on my side using Parent/Child Link type. it's working fine. Comment is adding on Parent issue (Story). It seems that you are doing something worng in issue lik relation in post function. Please make sure, Add comment post function must be after create issue post function.is parent of.PNGIssue link.PNG

 

Thanks

V.Y

Thanks 

In place of is parent of bug should be added right ?

Hi Vikrant,

 

it's working fine for me at the moment but i need a default format that needs to be generated when bug(child) has been created in parent ticket.

at the moment child ticket summary has been copied as a comment in parent ticket but the required format is like this

Ex- A new bug has been created

Reference: SF-1234  ( newly generated child issue key)

Summary: Unexpected item in the bagging area.

 

is that possible ?

@CHINNAMUTHEVISAI_SATYANARAYANASHARMA  It's not possible to add Issue key in a comment using JSU automation suite. Kindly use Scriptrunner post function to add custom comment on an issue. 

 

Add a comment to this issue [ScriptRunner]

OR 

Adds a comment to linked issues when this issue is transitioned [ScriptRunner]

 

Thanks

V.Y

Thanks Vikrant,

 

can you mention the script if possible.

we are able to match our requirement here.

but we are getting two comments one is with issue summary and other is with newly created issue key can we combine both and add as a one commentCapture.PNG

Try to add Custom scripted post function of adding comment having linked issue key and bug summary :- 

Kindly check link type of Bug in issue linking, if it's Outward change getInwardLinks to getOutWardLinks and change commentBody as per your requirement. 

import com.atlassian.jira.issue.link.IssueLink

import com.atlassian.jira.component.ComponentAccessor

import com.atlassian.jira.issue.Issue

import com.atlassian.jira.issue.comments.CommentManager

def issueManager = ComponentAccessor.getIssueManager()

def commentManager = ComponentAccessor.getCommentManager()

def issueLinkManager = ComponentAccessor.issueLinkManager

List allOutIssueLink = issueLinkManager.getInwardLinks(issue.id);

for (Iterator outIterator = allOutIssueLink.iterator(); outIterator.hasNext();) {

IssueLink issueLink = (IssueLink) outIterator.next();

def linkedIssue = issueLink.getSourceObject();

def bugkey = linkedIssue.getKey()

String issueName = linkedIssue.getSummary()

// dispatch an event after creating the comment

final boolean dispatchEvent = true

// the body of the comment

final String commentBody = """New Linked issue has been created ${bugkey}

${issueName}"""

// the author of the comment will be the logged in user

def author = ComponentAccessor.jiraAuthenticationContext.loggedInUser

ComponentAccessor.commentManager.create(issue, author, commentBody, dispatchEvent)

}

Thanks

V.Y

Suggest an answer

Log in or Sign up to answer
TAGS

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