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,559,203
Community Members
 
Community Events
184
Community Groups

How to automatically add a label to an issue at creation for a specific user

Hi, 

We have Jira 8.20.x DataCenter. In the workflow, I have already set a post function that:

When certain Request Types arrive in Queue, Jira

Automatically assigns those issues to (User A).

Now that these issues are assigned to (User A), we want to automatically add a label to all of these issues that says "WORKEXAMPLE"

 

I am new to Jira and was unable to do it with triggers, so I tried in autmation and it would not allow me to customize the options needed. Someone recommended Scriptrunner but I am new to it as well.

We currently have Automation and Scriptrunner Apps available to us :)

 

Can anyone possibly help?

2 answers

0 votes
Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Mar 27, 2023

Hi @Channing and @habib rahman -

This is all you need:

Screen Shot 2023-03-27 at 2.29.30 PM.png

If you do not see the fields for editing, they are configured here:

Screen Shot 2023-03-27 at 2.29.37 PM.png

0 votes
habib rahman
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.
Mar 22, 2023

Hi @Channing My name is Habib I will do my best to help with your question:


To automatically add a label to an issue at creation for a specific user, you can set up a "Create issue" automation rule that triggers when an issue is created and adds the label to the issue if the user matches a specific condition.

Here are the steps to set up this automation rule in Jira:

1. Navigate to the Jira administration panel and select the "Automation" section.
2. Click on the "Create Rule" button in the upper right corner.
3. Give your new rule a name that clearly indicates its intent, such as "Add label to issues assigned to User A".
4. In the "Starting events" section, choose "Issue Created".
5. In the "Conditions" section, add a condition that checks if the issue was assigned to User A. You can do this using the "Field value changed" condition and selecting "Assignee" as the field. Then, select "User A" as the user and choose "When issue matches the condition" as the trigger.
Note: check for the condition you need as there are a few listed below: In this example I will pick user A in this case will be me [Habib Rahman]
Screenshot 2023-03-22 at 21.23.01.png
6. In the "Actions" section, add a "Label issue" action and set it to add the label "WORKEXAMPLE" to the issue.
7. Save the rule.
Here is the Example:
Screenshot 2023-03-22 at 21.25.09.pngScreenshot 2023-03-22 at 21.25.35.pngScreenshot 2023-03-22 at 21.25.40.png

Now, when an issue is created in Jira and assigned to User A, it will automatically be labeled with "WORKEXAMPLE" by the automation rule.

Note: If the post function you've set in the workflow is already re-assigning the issue to another user after the initial assignment to User A, this automation rule may not work as intended. In that case, you may need to modify the workflow or add additional conditions to the automation rule to ensure that the label is only added under the intended circumstances.

If this helped please accept the answer as this could help others with the same issue as well. 
Thanks 

Habib.


Thanks Habib, that's interesting. I don't have Assignee as a field option there. I am missing Assignee and Issue Type as options. I also don't want all issues labeled for the employee, just a certain issue type.

Like habib rahman likes this
habib rahman
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.
Mar 22, 2023

Hi @Channing 

 I don't have Assignee as a field option there. I am missing Assignee and Issue Type as options

To add Assignee and Issue Type as a field options in Jira automation, you will need to ensure that these fields are set as "Global fields" in the project's configuration. 
Here's how you can do this:
  1. Go to Project Settings -> Fields
  2. Check whether the Assignee field and Issue Type field are set as Global fields. If not, click the "Actions" menu for the respective fields and select "Configure" to set them as Global fields.

Screenshot 2023-03-22 at 22.13.33.png

Once both fields are set as Global fields, you can use them in your automation rule.

To set the rule to only apply to a certain issue type, you can use a JQL filter to specify which issue types you want to target. 
Here is an example automation rule that only applies to a certain issue type:

 

1. Navigate to the Jira Automation section and click on "Create rule".
2. Give your rule a name and select the project/board you want to run the rule on.

3. Add the "Issue Created" trigger and select the "JQL filter" option.
4. In the JQL filter, specify the issue type that you want the automation rule to apply to. For example, if you want the rule to apply only to issues of type "Bug", use the following JQL filter: 
```
issuetype = Bug
```
5. Add an "Edit issue" action and scroll to the "Assignee" field. 
6. In the "Value" field under the "Assignee" field, enter the username of the employee who should be assigned to these types of issues.
7. Save the rule.

This rule will only apply to issues of the specified type and will assign the specified employee to the new issues automatically.

Thanks 

Habib.

Thanks So Much!! That makes sense. I'll work on that step to reach the other step. =)

Like habib rahman likes this
habib rahman
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.
Mar 22, 2023

You are welcome hope this helps. Have a nice day 

Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Mar 27, 2023

@habib rahman I don't believe your solution is correct for @Channing

Perhaps you misunderstood the original request. As I read it:

* He wants to set Assignee AND Labels when an issue is of a certain Request Type.

For some reason you only are setting Labels when the issue is assigned to a certain person. That might work in conjunction with another rule that sets the Assignee, but then you would be using two separate rules.

This can be done with a single rule.

Hi @Darryl Lee ,

I'm back in the office. You are correct! What would the rule config or syntax be to do Assignee AND labels when an issue is created of a certain request type?

If you would be able to help...

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events