How can I copy comments made on subtasks to the parent stories?

I'd like to copy comments made on subtasks to parent stories. Is there a way to do this? I tried it, but I'm getting errors in my automation log.

Attached screenshots show my error log and my rule setup.

Any ideas?

 

rule.png

log.png

1 answer

1 accepted

1 vote
Andreas Knecht Community Champion Feb 07, 2017

Hi Michael,

Here's an example of how you can achieve this:

Project automation - Code Barrel JIRA 2017-02-08 10-08-43.png

So the only difference is that I check that the issue that was commented is a 'Sub-task' with a jql condition.

I then also use the 'Add comment' action with the 

{{comment.body}}

smart-value.  'comment' is a special smart-value that will contain the comment the user entered with the action that triggered the rule (this works with 'Issue commented', 'Issue updated' and 'Issue transitioned' triggers for example).

Cheers,

  Andreas

WORKED! One minor thing, any way to tell who wrote it?

Andreas Knecht Community Champion Feb 07, 2017

Great! Yeah so you can access the author's details using 

{{comment.author}}

So for example this would give you their name and e-mail:

{{comment.author.displayName}} - {{comment.author.emailAddress}}

You could then use these in a 'Compare condition' to check for a specific user.

PERFECT! Is there a list of these kinds of values (for example - "thing.thing.thing") that the tool can access?

And is "smart fields" the proper name for these?

Be warned that with a lot of subtasks your parent issue's comments may become difficult to follow. JIRA doesn't have threaded comments so everything is all in one long stream. May be some way to add subtask comments to a custom field instead in the parent?

Andreas Knecht Community Champion Feb 09, 2017

Hey  Matt,

Yeah that's a good point.  You could definitely append the new comments to a custom field by doing setting a text custom field on the parent with an edit issue action like this:

{{issue.fields.Sub-task Comments}}

---
{{comment.author.displayName}} - {{#comment.created}}format="mediumDateTime"{{/comment.created}}:
{{comment.body}}

So in other words render the current value of the field and then append the new comment (with author and create date).

Another option is to continue using the 'Comment action' and prefix the comment with:

Sub-task commment ({{triggerIssue.key}}): 
{{comment.body}}

This would print out which sub-task the comment came from.

would {{triggerIssue.summary}} show the subtasks's summary? That would be more useful when deciphering what subtask it was from.

Also, it would probably be possible to do a compare of the comment value and if we put in a specific phrase "##Send to Parent##" in the comment body, ONLY THEN would we send it to the parent. 

Andreas Knecht Community Champion Feb 10, 2017

Hey Michael,

Yes {{triggerIssue.summary}} works to get the subtask's summary on the related issues branch.

And yes, you can add a 'Compare condition' right after the trigger, where you check that {{comment.body}} contains '##Send to Parent##'.  

Cheers,

  Andreas

Hi,

 

This works only if one comment is added onto the sub task. it does not cater for situations where different departments / individuals could be working on one issue and multiple comments are added on the various sub tasks. 

 

How do i enable that?

Thanks

Karabo

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Bridget Sauer
Published Thursday in Marketplace Apps

Calling all developers––You're invited to Atlas Camp 2018

 Atlas Camp   is our developer event which will take place in Barcelona, Spain  from the 6th -7th of   September . This is a great opportunity to meet other developers and get n...

359 views 0 6
Read article

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