Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.

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

JIRA Automation Rules to check if a value of a field exist on the same field of other tickets

Sara
Contributor
February 27, 2023

Hello, I need to create a rule that notifies me (by email) when a new issue is created and exists a ticket in other project where a custom field of the ticket created is the same, how can I create this?

I created one, but didn't work (the issue created if one of those issue types, and there is an issue that math the JQL, but in the log I got this: the issue didn't match the specified JQL (most likely), how can I set that I need exists one issue that match that jql and not the created one?)

Captura de Pantalla 2023-02-27 a la(s) 13.04.32.png

Thanks in advance.

2 answers

1 accepted

2 votes
Answer accepted
Jack Brickey
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 27, 2023

Hi @Sara , it would really help to see the structure of your JQL. I realize you have an obfuscated for a reason which I certainly understand. Would it be possible for you to create a JQL that is using test projects search that you could share the full JQL?

Sara
Contributor
February 27, 2023

 

This is the JQL: project = "X" and issuetype in ("t1", "t2") and status in ("Under Mapping", "Final setup") and "S name[Labels]" = {{issue.S name}}

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

So the JQL condition as written is assessing the issue being created. For example if "project X" is not the project associated with the issue being created then the condition would fail. Is that your intent? I thought you are trying to query for the existence of an issue in a different project. I think what you want is to use a Branch - Related issues and choose JQL. Further, within that branch, you will check to see if the JQL returns non-zero results and if true then send the email.

If I am off track here please let me know. If my assessment is accurate and you need further help please let me know. In order for me to take a reasonable attempt at the rule I need to know if the following statement accurately represents your use case.


When an issue is created in project-ABC I wish to search project-X for any issues where the value of custom field–123 is the same as the custom field–456 in the issue that triggered the rule. If any search issue exist in project – X then send an email to the dataoperations-manager.

Sara
Contributor
February 27, 2023

That's it! I want to find issues in another project, not in the same as the issue created.

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

Hi @Sara , have a look at this. There may be other approaches as well.

2023-02-27_13-47-04.jpg

my image does not show it but at the end after the compare you have an action to sed an email. 

Sara
Contributor
February 28, 2023

Hi @Jack Brickey ! finally I was able to created but the variable is set as empy but the custom field has value, not sure why. See next screenshots of the issue created and the log:Captura de Pantalla 2023-02-28 a la(s) 10.30.38.png

Captura de Pantalla 2023-02-28 a la(s) 10.28.42.png

Jack Brickey
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 28, 2023

Please share your rule.

Sara
Contributor
February 28, 2023

Captura de Pantalla 2023-02-28 a la(s) 14.00.42.png

Jack Brickey
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 28, 2023

Can you add an Audit log action right after the trigger that logs the value of your custom field - {{issue.Spider name}}

note, you need to be sure that the custom field name is precisely the same including capitalization as your custom field. 

retest your rule, and let's assess what that value is.

Sara
Contributor
February 28, 2023

Captura de Pantalla 2023-02-28 a la(s) 15.05.54.png

Sara
Contributor
February 28, 2023

I got it!!! thank you so much for all your help.

Now I just trying to set the proper email with all the information needed. Just a last question ( I promise!) is there a way to get the issuekey from the results of the lookup issues to add it the email? I've never used this option before. Thanks a mil again!

Like Jack Brickey likes this
Jack Brickey
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 28, 2023

ok. in that image it appears that the variable now has the expected value. Before that was not the case. Now the issue is in the lookup issues. For test purposes, could you simplify that JQL as follows

Project = "Business requests" and "Spider name[Labels]" = {{xProjectMatch}}

I am just trying to zero in on where the air might be. Also let me verify that your custom field is precisely named Spider name[Labels]. Is the [Labels] part of the name? Would you mind performing the JQL search below in the Advanced search issues view?

Project = "Business requests" and "Spider name[Labels]" = target

I am assuming that some issues in the project have "target" as the value in your custom field.

Jack Brickey
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 28, 2023

we crossed wires on our responses so forgot the above...

regarding "is there a way to get the issuekey from the results of the lookup issues to add it the email?" below is an excerpt from the docs that could be used in the comment...

All fields and custom fields can be accessed from the lookupIssues list. For example, to print the issue key for each issue in bullet point form:

 

1 {{#lookupIssues}}
2 * {{key}}
3 {{/}}
Like Sara likes this
0 votes
Sara
Contributor
February 28, 2023

I’ve tested but got an error, the custom field I used to match is type labels, maybe is due to this? (xProjectMatch={{issue.Spider name})
this is the error I got: Error rendering smart-values when executing this rule: Improperly closed variable: {{issue.Spider name}
Thanks so much for all your help! really appreciate it

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events