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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

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,637,725
Community Members
 
Community Events
196
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?

3 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 

1 vote
Mark Segall
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
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
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
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
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Jan 25, 2022

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

@Daria Avdeeva,

Maybe the below page will help you.

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

I replaced regex with these options.

Suggest an answer

Log in or Sign up to answer