Forums

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

Get a issueket form url

Patryk Kowalczyk January 27, 2025

Hello everyone

I have a case from user:

When we put in a URL link in to text custom fields we want's to automaticly update a few customefield in triggered task from url task.

When a creater a automation i have a problem with data from url.
To search issueKey in url:

1. Create variable with value:
{{issue.customfield_xyz.match("selectedIssue=([A-Z]+-\d+)")}}

2.Lookup Issues with JQL  issuekey = "{{issue.issuekeyFromUrl}}"

3. Edit issue

but always a get a error : "Custom Smart Value JQL Search: “(issuekey = ‘’) AND (project in (xyz))”. - Report key “” for field 'issuekey' is incorrect." so value is blank.

At the next step i was try:

1. Lookup Issues with JQL issuekey = {{issue.customfield_xyz.match("selectedIssue=([A-Z]+-\d+)")}}
2. Edit issue

I get a message with confirm automation but value in issue was blank

I don't know where is a problem.

Maybe someone had a similar problem and knows how to deal with it?

2 answers

1 accepted

1 vote
Answer accepted
Bill Sheboy
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.
January 27, 2025

Hi @Patryk Kowalczyk -- Welcome to the Atlassian Community!

For a question like this, context is important for the community to help.  Please post the following:

  • what type of project is this (e.g., company-managed, team-managed, etc.), 
  • an image of your complete automation rule in a single image,
  • images of any relevant actions / conditions / branches,
  • an image of the audit log details showing the rule execution, and
  • explain what is not working as expected and why you believe that to be the case.

Until we see those...

When using a created variable, such as named issuekeyFromUrl, that is referenced alone and without an issue prefix.  For example as:

{{issueKeyFromUrl}}

 

Next, I recommend adding a write to the audit log to confirm the URL and variable value contain what you expect:

https://support.atlassian.com/cloud-automation/docs/jira-automation-actions/#Log-action

 

Kind regards,
Bill

Bill Sheboy
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.
January 28, 2025

Thank you for the additional information. 

When responding, please stay in one conversation thread.  That will help others reading this question in the future know if there are multiple possible answers.  Thanks!

 

Please re-read what I posted above, as your rule's JQL is still incorrect.  It should be this:

key = {{issuekeyFromUrl}}

 

Also, if that variable {{issuekeyFromUrl}} is empty, the field did not match your regular expression. 

Please post an example of a value from customfield_10353 (the field checked by the match function) to help compare to the regular expression.

 

Like Patryk Kowalczyk likes this
Patryk Kowalczyk January 29, 2025

Okay so I was read one more time posted about rule's JQL.
You have right, I was had a mistake in function so I correct this.

In next step I have changed my apporach and start use substringAfter  function instead of .match. 

I added options to the function with the addition of a comment to check what value of a variable I get with a given function

This is a flow of my new automation function:
Zrzut ekranu 2025-01-29 132319.png

In event log I get a success status, but fileds don't complement each other according to automation.

Comment who I add look like
Zrzut ekranu 2025-01-29 132616.png

And result
Zrzut ekranu 2025-01-29 132648.pngZrzut ekranu 2025-01-29 132648.png

 Example of a value from customfield_10353 is in TestString2 

Is there an error in my thinking somewhere here?
It seems to me that the function {{issue.customfield_10353.substringAfter("/browse/")}} should only return “DEW-1302” and then this should be retrieved by automation

Bill Sheboy
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.
January 29, 2025

Please use the Log action to write test expressions to the Audit Log, rather than adding comments.  When comments are added, formatting is modified / interpreted, and makes diagnosing rule problems more difficult.

https://support.atlassian.com/cloud-automation/docs/jira-automation-actions/#Log-action

 

This is one reason I asked you to paste a value from that field directly in your message response and to write it to the audit log. 

 

If the value in the field is a smart link, the issue key is likely in the text twice, and so must be parsed accordingly.  For example, the field may contain this:

[yourJiraURL/browse/DEW-1302|yourJiraURL/browse/DEW-1302]

In that case, you could get just one key like this:

{{issue.customfield_10353.match("([A-Z]+-\d+)").first}}

or

{{issue.customfield_10353.substringAfterLast("/").substringBefore("]")}}

 

Like Jack Brickey likes this
Patryk Kowalczyk January 31, 2025

Thank you for your advice.

I added the audit log action to my automation and got interesting findings.
The problem is not with the smart value, but with the search function.

The automation cannot find any problem with my key.Zrzut ekranu 2025-01-31 110615.png


I added permissions for the jira automation user to the project where the issue being searched is, but it still doesn't work.
(The issue being searched for is in a different project than the trigger issue).

Additionally, I tried adding “PROJECT IN(”DEW")” to my JQL issue search, but the effect is the same.

Maybe I should use another function to search for the problem in another project?

Jack Brickey
Community Champion
January 31, 2025

just a thought...Is the automation rule setup for multi-project or global?

Like Bill Sheboy likes this
Patryk Kowalczyk January 31, 2025

The rule is configured for a specific project and gives the automation user permissions to another project, which is a potential search

Jack Brickey
Community Champion
January 31, 2025

Understand but it may be that, in order to reference an issue in another project the rule needs to be multi-project. I have never tried this previously. Can you try this? Alternatively as a test try referencing an issue in the same project.

Like # people like this
Patryk Kowalczyk February 3, 2025

@Jack Brickey  

You are right!

When I change the automation scope to global, it starts working fine!

0 votes
Patryk Kowalczyk January 27, 2025

Thank you @Bill Sheboy for instruction!

Now i put missing information:

Project is company - managed

First versionwas very simple:
Zrzut ekranu 2025-01-28 081539.png

In audit log I was get a sucess status but data have not complemented each other.
In my opinion this shoulde found a issue with issueKey and completed this fields.

Second version with new created variable:
Zrzut ekranu 2025-01-28 081133.png
Zrzut ekranu 2025-01-28 082822.png

Zrzut ekranu 2025-01-28 082924.png

And here i get errors "Unable to run the search while custom values were being defined: ."
Zrzut ekranu 2025-01-28 083000.png

Probably variable don't have value but i don't know why



Suggest an answer

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

Atlassian Community Events