Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,297,277
Community Members
 
Community Events
165
Community Groups

Regular expressions in automation and smart values

Hello,

I need to get an email from summary of issue and put it in a text field in the same issue.

I use JQL:

issueFunction in issueFieldMatch('project = ATLAS AND issuetype = "Chore"', "summary", "[a-zA-Z0-9_!#$%&'*+/=?`{|}~^.-]+@[a-zA-Z0-9.-]+")

that works correct, because it find one and only issue fitting the conditions. So it means that my regular expression is OK.

Снимок экрана 2022-01-24 в 16.37.22.png

Then I've created a simple automation like on screenshot below

Снимок экрана 2022-01-24 в 16.33.45.png

and it works every time, but nothing happens in issue fields. I mean I see success status in audit log, but when i check the issue link I see that there is no any new value in that field. 

The example of smart value for text field i got from documentation here: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-text-fields/Снимок экрана 2022-01-24 в 16.36.34.png

Any idea why smart value from action in my automation doesn't set the email to a text field? Maybe I have a smart value syntax error in action?

2 answers

Hi @daria

I'm joining the party a bit late here but I've just encountered a similar issue that lead me here. 

I tried to run a simple regex in my automation but the output was blank despite the pattern working as expected. What solved the issue for me was to add a capture group to my pattern.

My pattern that was returning an empty set: "[\w-]*$"
My pattern that works as expected: "([\w-]*)$"

You might achieve the desired result by changing

"[a-zA-Z0-9_!#$%&'*+/=?`{|}~^.-]+@[a-zA-Z0-9.-]+" 

to: 

"([a-zA-Z0-9_!#$%&'*+/=?`{|}~^.-]+@[a-zA-Z0-9.-]+)"

I hope this helps 

0 votes
Mark Segall Community Leader Jan 24, 2022

Hi @Daria Avdeeva 

I may be mistaken, but I believe .match is used to evaluate the regex.  I believe you want to use Quote...

{{issue.summary.quote("[a-zA-Z0-9_!#$%&'*+/=?`{|}~^.-]+@[a-zA-Z0-9.-]+")}}

Hello, Mark!

I've just tried it now, but that smart values also gives zero values (nothing) to my field. It also cleared any values from field if i set their manual.

Mark Segall Community Leader Jan 24, 2022

Hi @Daria Avdeeva 

I'm having the same issue in my test environment.  It does look like your original use of match should work.  I may need to lean on the other community members to help solve this one.

As for making sure it's not overwritten, I would add one of the following to your automation:

  1. Update JQL
    AND Test Field IS NOT EMPTY
  2. Add a condition to your rule for Test Field IS NOT EMPTY

But what it will explain or give to me? When i add "AND "Test field for email from summary" IS NOT EMPTY" it won't find any issue for such JQL.

I've also checked it with "Test field for email from summary" IS EMPTY" to be sure that there is no any value in the field.

Mark Segall Community Leader Jan 25, 2022

@Daria Avdeeva - Sorry that's what I get for multitasking 🤦‍♂️.  Correct, that should be IS EMPTY

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you