Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Automatically adding a label when creating an issue

Sabrina Sykes-Gelder September 18, 2023

Hi there

I would like to know whether it is possible and if so how, I can auto create/add a label based on the issue summary.

 

e.g. I create a new issue called ACMEInc (this then runs multiple other actions) I would like a label of ACMEInc to added to this issue and subsequent linked issues.

 

I am still very new to doing all of this so if someone is able to respond please keep the instructions very simple and clear :-) 

 

Thank you

1 answer

1 accepted

0 votes
Answer accepted
Mathew Lederman
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 18, 2023

For the base ticket, this is fairly simple using Jira Automation.  On creation, set the label as {{issue.summary}}. This is a smart value which can be quite useful in automation. I've copied a link of their documentation here: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-issues/

Adding the same label to subsequent linked issues may be a bit more difficult, but here's how I would go about doing this in a separate automation:

  1. Trigger: Issue Linked
  2. Related Issues Condition
    • Related Issues: Linked Issues
    • Link Types: All Link types
    • Condition: Are Present
  3. Edit Issue Fields: Linked Issues = Trigger Issue

Let me know if you need any help setting this up.

Sabrina Sykes-Gelder September 18, 2023

Hi Mathew

Thank you for responding - I can't seem to get this to work when I create my first issue, I am sure I am missing something really easy/obvious!

Blank Label.PNGLabel Logic.PNG

Mathew Lederman
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 18, 2023

Sabrina,

No problem. Typically with labels you want them to be limited to a pre-defined list otherwise your list of labels can get a bit out of control.

To do what you're looking for however, you should be able to type {{issue.summary}} into the Labels box. Jira should recognize you're trying to use a smart value and accept the entry. 

image.png

Sabrina Sykes-Gelder September 18, 2023

Unfortunately that doesn't seem to have worked.

The labels won't get too out of control as I am using this as a way of an onboarding checklist for certain customers.

 

If there is an alternative board or process that would work better please advise, as I am very much on a steep learning curve with using Jira to manage such tasks and streamline things.

Mathew Lederman
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 18, 2023

I very much understand what you're going through. Jira is a fantastic tool when you know how to use it, but it definitely has a steep learning curve.

Are you getting an error or some not that won't allow you to perform the action directly? Might help in troubleshooting.

For what you're trying to do, I would recommend a custom field (ideally an existing field) rather than labels. Labels are typically used for categorizing issues across a single project, multiple projects, or even across the entire instance.

You could also add the label or another custom field to the create screen so that you're not having to automate behind-the-scenes, but this is an additional field your users will have to fill out

Sabrina Sykes-Gelder September 18, 2023

I am seeing the following on the audit log - Not valid JSON


Label Audit Error.PNG

 

I am having a similar nightmare trying to auto add a start date based on now plus X business days.  I can create the due date just fine - {{now.plusBusinessDays(65)}} that works a treat but not for start date :-(

Mathew Lederman
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 18, 2023

Could that JSON error come from the advanced edit you're trying to perform? 

For the dates, I would recommend comparing the configuration of each custom field. Start Date may be forced to today, just as an example.

Sabrina Sykes-Gelder September 19, 2023

Hey there

I don't think I am trying to perform an advance edit, the item gets created from the add new issue area at the bottom of the listing and only requires you to enter the summary which for the most part is just one - three words.

 

I am not using any custom fields and the start date doesn't show at all, unless I manually enter the date.  Ideally, I am wanting it to be more fluid than that, to make things easier for the team. Perhaps I am trying to run before I walk :-)

Mathew Lederman
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 19, 2023

Hi Sabrina,

Based on your screenshot, on the left side bar it says When: Issue Created, Then Edit issue fields Labels, Advanced. I don't see a field called advanced, so I assumed you were trying to do some additional configuration programmatically which would explain where the JSON errors are coming from. 

I would suggest trying to create a new rule and starting with the most basic options, try to build out what is needed one step at a time.

  • When: Issue Created
  • Then: Edit issue fields: Labels

Start there, see if that works. If it does, start adding more to it like your sub-task creation.

Sabrina Sykes-Gelder September 19, 2023

That is fab, I must have been doing something else which was causing an issue.  This seems to have worked - yeah!!

 

Thank you so much for your assistance!!!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events