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

Channing March 22, 2023

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?

1 answer

1 accepted

1 vote
Answer accepted
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.
March 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

Raphael Fernandes August 25, 2023

By adding this automation, the previous labels would be overwritten? I need this feature but not removing the previous labels, but only adding a new one such as "reviewed"

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.
August 25, 2023

Hi @Raphael Fernandes --

The Labels field has a handy ADDREMOVE option that lets you do exactly what you want:

addlabels.jpg

Like # people like this
Raphael Fernandes August 25, 2023

That worked. Thanks a lot

Like # people like this
Kristen April 24, 2024

That solution did not work for me.  It's still overwriting all of the other labels that exist. 

Like Matthew Sharp likes this
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.
April 26, 2024

For the Labels fields, if you click the [...] and choose ADDREMOVE, you should see two fields: Values to add, and Values to remove, as in this this image from @Trudy Claspill's post:Screen Shot 2023-04-21 at 12.35.58 AM.png

Are you seeing that? And you're only putting labels you want to add under Values to add?

Kristen April 26, 2024

Yes. I have done that exact ADDREMOVE, and still it's overwriting all of the labels, and only adding the ones stated in the automation.  

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.
April 26, 2024

Huh, that's odd. Are there any other Edit operations in your rule? If you can share a screenshot of your rule, we would be able to see if there's anything that looks awry.

But without that, I would look at a few things:

Issue history - is it showing just a single entry like:

 

Automation for Jira updated the Labels March 7, 2023 at 4:06 PM HISTORY
Old Labels -> New Labels

Or I'm wondering if two updates might happen:

Automation for Jira updated the Labels March 7, 2023 at 4:06 PM HISTORY
Old Labels -> None
Automation for Jira updated the Labels March 7, 2023 at 4:06 PM HISTORY
None -> New Labels

Audit log - does the audit log show more than one edit/update happening?

Also, you might try just adding some Log actions for debugging, printing the value of {{issue.labels}} at various points during the rule.

Like Kristen likes this
Kristen April 26, 2024

Thanks, Darryl!  I'll take a peak at it again and provide screenshots where necessary! 

Suggest an answer

Log in or Sign up to answer