Forums

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

Automation rule failing to fetch phone number which is in a table from description

Sateesh Dara
Contributor
April 4, 2025

In JIRA SD, the ticket description has an HTML table in that there is a phone number .
I wanted to extract that and update it in the "User Phone Number" field using the automation rule below. But it's throwing an error and not working. Used different smart values. Out of those some ..

{ "fields": { "customfield_15023": { "value": "{{issue.description.match('(010[0-9_.+-]+)')}}" } } }

Error: Char can't be parsed from: '010[0-9]{8}')

 

{ "update": { "customfield_15023": [{ "add": {"id":"{{issue.description.match('(010[0-9_.+-]+)')}}"} }] } }

Error: Failed to get value for issue.description.match('(010[0-9_.+-]+)')

Rule-Details.jpg

 

Errors-Audit.jpg

3 answers

1 vote
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.
April 6, 2025

Hi @Sateesh Dara 

Several of the characters in the character-class for the regular expression are reserved, and so they need to be escaped.

 

You note the Description field contains a table in HTML.  Are you certain it is HTML or is it the rich text, table markup for the field (using pipe characters)? 

Regardless, it is likely both formats have embedded newline characters in the field and that impacts the behavior of the match function.  I recommend replacing the newlines with spaces to help the match:

{{issue.description.replace("\n", " ").match...

 

I recommend using a test rule which just writes the Description to the audit log, as well as what you parse with the match() function.  That will help to incrementally improve your regex until you get the desired result.

 

Kind regards,
Bill

0 votes
Sateesh Dara
Contributor
April 8, 2025

Some how this worked for me(Though not so accurate).
Worked.jpg

0 votes
Marc - Devoteam
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.
April 4, 2025

Hi @Sateesh Dara 

Whenever you ask for help with an Automation Rule it will help us to help you if you provide:

1. what type of project is this (e.g., company-managed, team-managed, etc.), 

2. images that show your complete rule.

3. images showing the details of any relevant actions/conditions/branches.

4. images showing the Audit Log details for the rule execution.

5. Explain where the issue is.

These questions are not for not willing to help, but to have community members understand on how automation works.

Sateesh Dara
Contributor
April 4, 2025

Its a Service Desk project.
Somehow phone number is not getting fetched from Description of the ticket/JIRAissue.
Rule-Details.jpg

Marc - Devoteam
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.
April 4, 2025

Hi @Sateesh Dara 

What is the audit log showing and how does the description look like on an issue.

Sateesh Dara
Contributor
April 4, 2025

Description of a ticket.jpg

Sateesh Dara
Contributor
April 4, 2025

Audit log image is added to main details.

Marc - Devoteam
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.
April 4, 2025

Hi @Sateesh Dara 

1st thing to do.

Add a log action in you automation, log action to take is: {{issue.description.match(".*010: (\S+).*")}}

What will be stored in the log action?

Suggest an answer

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

Atlassian Community Events