Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

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,458,747
Community Members
 
Community Events
176
Community Groups

Create subtask(s) while adding a comment in a task

I would like to create automatic (with a tag for example) a sub-task when i'm adding a comment in a task. 

Sometimes I want to inform people with a comment about current stats and combining this with creating new sub-tasks to solve the issue.

is this possible?

1 answer

0 votes

Hi @Sharon Freij 

First thing, I am not using the Jira Core Server version...and...

My understanding is that Jira Core Server can use Automation for Jira (if it is installed).  Using an automation rule triggered on Issue Commented you could check for a person mention and then add the subtask assigned to them.

Please check with your Jira Admin if you have automation installed, and if so take a look at these sources/examples to get you started:

Kind regards,
Bill

Hi @Bill Sheboy  , thank you for the quick reply. 

I've tried several options and still have some open questions, hopefully someone can help me with it ! 

So situation is:

1. During weekly meeting we create notes in Jira comments. Sometimes we have tasks to follow up, but this is stored in a comment. Sometimes with sometimes without user mention.

2. If user mention is available, I would like to create a NEW sub-task based on the content of the comment.

3. I'm able to do that, but only with a general summary for the sub-task. I did copy the content of the last comment in the parent, but it's assigned to no-one. 

 

I have 2 questions:

1. Can i create multipe subtasks based on 1 comment? For example the comment consists of:
#usermention Sharon has to check possibility delivery time.
#usermention Bill has to confirm the dimensions 
Now I, ofcourse, would like to have 2 different sub-task with 2 different summary's.

2. Then ... ofcourse I would like to have the sub-task assigne the same as the #usermention. 

Any ideas? It seems complicated, I was just curious if we can do something in automation with it.
If you do know the answer on how to add the assignee the same as #usermention in the comment on parent level, I would like to hear it :).

 

regards and thanks for your help,

Sharon

Hi, Sharon.

Yes, you can do those things...using the string functions to help...and you need to use a consistent pattern in your comments.

Let's say your comment has a line for each task, with at most one mention per line (anywhere in the line).  Then this example rule would do it...details described below:

comment mentions to subtasks.png

 

  • trigger: issue commented
  • advanced branch: to split the comment into lines of text
    • smart value: {{issue.comment.last.body.split("\n")}}
    • variable name: varBodyLine
  • action: create a variable for the mentioned user's account id
    • variable name: varAccountId
    • smart value: {{varBodyLine.match("\[~accountid:(.*)\].*")}}
  • action: create a variable for the task, removing the account id
    • variable name: varTheTask
    • smart value: {{varBodyLine.replaceAll("(\[~accountid:.*\])","")}}
  • advanced compare condition: check if someone was mentioned in the line
    • first value: {{varAccountId}}
    • condition: does not equal
    • second value: leave this as empty
  • action: create a subtask
    • set the summary to {{varTheTask}}
    • set the assignee to {{varAccountId}}
    • You will need to type in those smart values, and then select them when they appear below the field.

 

Please modify this as you need, and let me know if it helps.  Thanks!

 

Kind regards,
Bill

Hi @Bill Sheboy 

Wow, thanks for your answer. I fully understand, but still facing some issues in my own Jira environment.. :(

2022-03-05_11h23_42.png

Well, I'm not able to find the 'Advanced Branch' --> 'for each smart value'. I can only find 'JQL'. 
Something to do with the Jira version I have?

2022-03-05_11h24_48.png

 

Last but not least, 'then create variable' is also something which is not possible. 
Think that it depends on permissions or Jira version. Unfortunately don't have the same as you, so think it will not work.

besides that, many thanks for your help!

Sharon, my apologies that I forgot that Advanced Branching and Create Variable are not yet supported for Jira Server versions. 

Please watch this thread to see any updates on advanced branching: Jira Automation - Advanced Branching over smart values (atlassian.com)

I believe there is a suggestion for adding Created Variables to Jira Server/Data Center, but I am unable to find it.

 

Those gaps mean you may only add one subtask at a time per comment, and you will need to inline all of the information extractions.  For example:

  • trigger: issue commented
  • condition: status is not "done" or the name of your completed status.  This prevents adding subtasks for completed items.  :^)
  • advanced compare condition to check if someone was mentioned
    • first value: {{issue.comment.last.body.match(".*\[~accountid:(.*)\].*")}}
    • condition: does not equal
    • second value: leave this as empty
  • action: create subtask, setting the fields
    • summary: {{issue.comment.last.body.replaceAll("(\[~accountid:.*\])","")}}
    • assignee: {{issue.comment.last.body.match(".*\[~accountid:(.*)\].*")}}

 

Please try that to see how it helps.  Thanks!

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events