Pulling Data from Summary and Adding that to comments

Jay February 2, 2024

I am attempting to make tickets easier for my team to read. I previously posted about making custom variables and I'm not sure thats the path to go. 

The current goal is to take RegEx (which is verified) and use that to pull the required data from incoming tickets. Then taking that data that I need to pull, I want to create a comment with that data.

I've attempted it and when I add the comment its always blank, I have made sure adding comments is working by adding plain text and that shows up. 

When attempt to use either regex or even save the regex as a variable, I get an error>

Action details:

Manual trigger
User triggered the rule
Issue condition
The following issues passed:
ISR-93
Comment on issue
Error adding comment to issue
Comment body can not be empty! (comment)

If anyone can assist I would be grateful, if more information is needed I can provide some scrubbed email content that we are attempting to use.
EDIT:
Adding the smartvalues I'm attempting to use:
{{issue.description.match([\s\S]*?(?=Recommendation))}}
{{issue.description.match(^Log\sSource[\s\S]*?(?=\sCount))}}
{{issue.description.match(^Portal.+)}}


EDIT:

It did work for the first one, but the last 2 even like that are pulling empty. I tested the regex again and its capturing in regex testing, but still showing empty. If you could help 1 more time I'd really appreciate it.

for first one:

Log Source Device Name : O365

Source IP : xxx.xxx.xxx.xxx

Source User : someone[.]random@regex[.]com

Alert ID : INSIGHT-81

Alert Date : 2024-01-19 12:39:28

Action : File Downloads

Count : 697


For the second one this is what it is looking for.

Portal - Ticket: 0002334

1 answer

1 accepted

5 votes
Answer accepted
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.
February 2, 2024

Hi @Jay - I haven't tested, but I believe you need quotes around your regex:

{{issue.description.match("[\s\S]*?(?=Recommendation)")}}
{{issue.description.match("^Log\sSource[\s\S]*?(?=\sCount)")}}
{{issue.description.match("^Portal.+")}}

 

Jay February 2, 2024

Thank you for your response. Unfortunately it is still showing as "empty" in the automation.

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.
February 2, 2024

Ok - I just played with the first one and it looks like you also need to encapsulate the regex in parantheses:

{{issue.description.match("([\s\S]*?(?=Recommendation))")}}
Like Jay likes this
Jay February 2, 2024

@Mark Segall 

It wouldn't let me reply, I have edited and added my reply to the bottom of the orriginal post, if you have a moment,

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.
February 2, 2024

These are working for me in my testing:

{{issue.description.match("(^Log\sSource[\s\S]*?(?=\sCount))")}}
{{issue.description.match("(^Portal.+)")}}

 

Joseph Chung Yin
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 2, 2024

@Mark Segall - 

Nice finding...  Thanks

Best, Joseph

Jay February 2, 2024

Interesting...still comes back as "empty" on mine...I guess I'll keep poking it because clearly it is an issue on my side if its working for you. Thank you!

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.
February 2, 2024

Note for each of those last two, the regex requires the respective "Log Source" and "Portal" to be on the first line.  I'm not sure if that's your intent.  If it is, it worked for me in my testing and I literally copy/pasted the smart values from my environment after confirmed test.

Jay February 2, 2024

Oh I wonder if thats the issue...in Regex101 it can grab it from anywhere in the big email, it sounds like that isn't working in Jira. Not sure if thats a Jira issue or Regex ;/

 

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.
February 5, 2024

I played around with it a little further and was able to make those last two work like this:

{{issue.description.match("((?i)Log\sSource[\s\S]*?(?=\sCount))")}}
{{issue.description.match("((?i)Portal.+)")}}

You may want to put it through more rigorous testing, but my tests returned desired results.

Jay February 5, 2024

I'll put some testing in on this today and likely accept as answered. Thank you much, you are a super star!

 

Jay February 5, 2024

@Mark Segall it works perfectly, you are my hero! 

Like Mark Segall likes this

Suggest an answer

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

Atlassian Community Events