I have the following steps within a single rule:
1. Create variable - {{firstName}}
smart value - {{issue.comments.last.body.match("[A-Za-z]+(?=\.)(?=\.\w+\@jamf\.com)").capitalize()}}
2. Create Variable - {{lastName}}
smart value - {{issue.comments.last.body.match("(?<=\w+\.)[A-Za-z]+(?=\@jamf\.com)").capitalize()}}
3. Create Variable - {{fullName}}
{{firstName}} {{lastName}}
I validated the regex using two different regex sites.. but neither matches on the comment body:
"Alert LMD873080672 status changed: ack ----- Alert lbextd01.fluff.net/LinuxNewProcesses-/opt/cisco/amp/bin/ampdaemon/Status is acknowledged by ben.hart@fluff.com
Previously I had a variable being defined by: {{issue.comments.last.body.match("(\w+\.\w+(?=@))").replace(".", " ")}}. And it worked great! But I need the first and last name variables with proper capitalization in order to use them to assign Incidents. I can't think of a better way other than splitting it, and using .capitalize on each, then recombine them.
Maybe Jira doesn't like Positive lookbehinds?
What am I doing wrong here?
Hi @Ben Hart
Are you trying to assign the issue using the user name with a Jira Cloud automation rule? If so, that is not possible: the rule will need to use the account ID value for the user.
To get the account ID from the user name, the rule would need to call the REST API user search function using the Send Web Request action.
Kind regards,
Bill
Hey Bill.. So help me understand please. If I add a `Then: Assign the issue to` step. I tried both; assign issue to smart value and specify user. Both of which accept a smart value as a value. So what you are saying is, that won't or is not supposed to work?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
After looking further.. I see the mention that JQL queries can no longer use the dusplay name but user id instead, due to GDPR. But I see nothing in print so far that tells me you cannot assign an issue from a smart value of a users name/dispalyName.
However.. because time is fading and I'm a super anxious person I am now experimenting with a lookup table for name -> id.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, this is a GDPR change impact. For Jira Cloud, I believe the current options are:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Gotcha.. well just to be sure then am I correct in understanding that you can call/reference lookup table keys using smart values?
For example, creating a variable {{fullName}} from {{issue.comments.last.body.match("(\w+\.\w+(?=@))"}}
Which would equal bob.smith, who is also a key in the lookuptable, `bob.smith`.
Then assign the issue to - {{assignTable.get("{{fullName}}"}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Almost...there is no need for the quotation marks around the name or the extra curly brackets.
{{assignTable.get(fullName)}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Awesome; I am glad to learn that helped!
For learning, I recommend lots of experimentation in test projects...writing things to the audit log, and reading community posts. Those help fill in the gaps from the documentation.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I found another, older post where someone was asking something VERY similar. But it worked. Basically I set the initial variable using:
{{issue.comments.last.body.match("(\w+\.\w+(?=@))").replace(".", " ")}}
Then use a second one with:
{{fullName.split(" ").capitalize().join(" ")}}
Works like a champ! Except now the rule still fails to assign but it's reportedly a permissions issue now. Ill start a new post for that one.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.