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

Extracting labels from hashtags in the summary field

devguydavid
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 28, 2022

I like using hashtags as labels. Some tools support this as part of a "quick entry" feature, like Todoist's Quick Add feature.

For example, in Quick Add if I enter:

Clean the car #for-wife

It will create a new todo with a title of "Clean the car" and a label of "for-wife".

This can be accomplished with Jira automation!

Navigate to Project Settings -> Automation.

Click the "Create Rule" button.

Select the "Field value changed" trigger and select the "Summary" field and click "Save".

Click "New Condition" -> "Issue fields condition".

Select "Summary" for the "Field".

Select "contains" for the "Condition".

Enter this for the Value:

 #

(Note that is <space>#)

Click "New branch" -> "Advanced branching".

Enter the following smart value:

{{issue.summary.match(" #(\w+)")}}

and the following Variable name:

mylabel

and click "Save".

Click "Add component" under the "For each" branch and click "New action" -> "Edit issue".

Choose the "Labels" field to set.

Next to the field click the three-dot menu and select "Add/remove values".

In the "Values to add" field enter:

{{mylabel}}

and select the resulting "Smart value {{mylabel}}" menu entry (this is not obvious but critical!).

Now click "Save".

Do you want to automatically have Jira remove the hashtag values from the summary? Then do this:

On the component line that is executed after the "For each" click "Add component" -> "New action" -> "Edit issue".

Under "Choose fields to set..." select "Summary".

Enter this in the Summary text field:

{{issue.summary.replaceAll("( #\w+)", "")}}

and click Save.

Ok, now regardless of whether you added the removal of hashtags or not, you need to save and publish this rule:

Give your automation a name in the "Name your automation..." text field. Something like "Extract labels from summary hashtags" works.

Now click the "Turn it on" button. Done!

To test, simply edit a current ticket or create a new ticket and include some hashtags in the summary:

This is my test ticket #foo #bar

Shortly after saving the ticket you should see new labels "foo" and "bar" show up on the ticket.

Congratulations!

Here are some screenshots to show what it looks like when set up properly:

Screen Shot 2022-07-28 at 5.48.37 PM.png

Screen Shot 2022-07-28 at 5.48.44 PM.pngScreen Shot 2022-07-28 at 5.48.49 PM.pngScreen Shot 2022-07-28 at 5.48.55 PM.pngScreen Shot 2022-07-28 at 5.49.01 PM.png

0 comments

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events