Missed Team ’24? Catch up on announcements here.

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

Need help with smart values match regular expression for email domain name

mobiusinteractive April 21, 2021

Hi,

Problem:
I'm trying to get the domain name of the reporter to be set as a label in my issues as they are created. Right now, I have a regular expression working in all of the regex testers online, but when I try it in JIRA it does not work. It returns a blank string or nothing at all.

What I'm looking for is if the reporter's email address is test@mydomain.com, I would like the label to be mydomain


My automation JSON code for updating the label is below:

{
"update": {
"labels": [
{
"add": "{{reporter.emailAddress.match("(?<=@)[^.]+(?=\.)").asJsonString}}"
}
]
}
}

I have tried with asJsonString and without asJsonString. 
I have tried with escape slashes and without slashes

Any help would be appreciated. If not I will use the fall back of 
"add": "{{reporter.emailAddress.substringAfter("@")}}"
which returns the full domain name.

 

Thank you again in advance.

 

2 answers

1 accepted

2 votes
Answer accepted
Angélica Luz
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 23, 2021

Hello @mobiusinteractive,

Thank you for reaching out to Atlassian Community!

 We were able to test here and confirm that the smart value that gets only the reporter’s domain is the one below:

{{reporter.emailAddress.substringAfter("@").substringBefore(".")}}

Please, take your time to test and let us know how it goes.

Kind regards,
Angélica

mobiusinteractive April 26, 2021

Hi Angelica!

Thank you for this. The only thing I wonder is if an email address is in the form firstname.lastname@domain.com if it will work or not. I think it still will work for this, but not 100% sure.

The final code i put in was this:

 

{
"update": {
"labels": [
{
"add": "{{reporter.emailAddress.substringAfter("@").substringBefore(".")}}"
}
]
}
}

Angélica Luz
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 26, 2021

Hi @mobiusinteractive,

I tested here with my email which is name.lastname@company.com and it works, it got only the domain.

Hope this helps!

Like Dave Liao likes this
mobiusinteractive April 26, 2021

Awesome! Thank you so much Angelica! You rock! It's working for us thus far.

Like # people like this
0 votes
Vando Goncalves _e-Core_ April 23, 2021

HI @mobiusinteractive !

In addition to @Angélica Luz 's Answer, there also another option.

You could use Organizations field, and set it based in the customer's domain:

https://blog.codebarrel.io/set-organization-in-jira-service-desk-using-reporters-email-domain-e705be9d4717

Best Regards

mobiusinteractive April 26, 2021

Hi Vando,

Thank you for this, I think this is great as well, but we need it as a label so we can integrate Clockify slightly better into your helpdesk. I think we will use this regardless, but it didn't help the actual need we need for this specific issue.

Thank you!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events