trying to fetch url from description and assign to Destination URL custom field

Dinonath Khan May 16, 2024

Screenshot from 2024-05-17 10-05-51.pngScreenshot from 2024-05-17 10-07-50.pngScreenshot from 2024-05-17 10-11-14.pngScreenshot from 2024-05-17 10-11-34.pngScreenshot from 2024-05-17 10-11-57.pngScreenshot from 2024-05-17 10-12-14.png

Screenshot from 2024-05-17 10-31-25.png

Hey There,

 

My requirement is like customer will send a request through email and it will create a ticket in Jira service management

so there is one filed called Destination URL 
so when customer mention the url in the email body i want through automation it should fetch from description and assign to custom field(Destination URL) but i don't know what is the problem it is not fetching from description to the custom field(Destination URL) , and i am getting success message also in audit log

please tell me is there a problem in regex pattern(regular expression) or any other problem is there?

my regex patten  in edit rule condition is ==> {{issue.description.match("Destination URL\\s*:\\s*(https?://[^\\s]+)")}}

and i tried with other regex pattern also, but not working. even i am getting success in audit log
why it is not catching from description to custom field please look into it.

1 answer

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.
May 18, 2024

Hi @Dinonath Khan 

The automation documentation is unclear what is (and is not) supported in regular expressions for the match function.  Instead it states (with emphasis added by me):

The underlying implementation is based on Java's Pattern class and uses Matcher.find() to find matches.

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-text-fields/#match--

There are multiple community posts describing regular expressions that work with a variety of construct definitions which do not work in rules.

 

As it is unclear what works and does not, I recommend trying the simplest expression that can possibly work, test, and then incrementally add to the expression until done, or it stops working.  That will give you something that at least partially matches.

 

Two things are certain to me:

The rule matcher does not handle line breaks well, and may lead to missed matches.  The workaround for that is to always split on newlines first before matching, such as with this:

{{issue.description.split("\n").match(your match expression)}}

Perhaps try that first before altering the expression further.

 

Next, there appear to be parsing order problems for regular expressions and the match() function.  The workaround for that is to first store the expression with Create Variable and then use that in the action.  For example:

  • action: create variable
    • name: varRegEx
    • smart value: 
Destination URL\\s*:\\s*(https?://[^\\s]+)
  • some action to use the variable...
{{issue.description.split("\n").match(varRegEx)}}

That technique also helps when creating a dynamic regular expression which contains data from an issue field.

 

Kind regards,
Bill

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