Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Jira Automation related question

Bhumi Yadav July 17, 2024

I have created a rule, when I close ticket  rule checks if Comment section contain any http,https, confluence, jira, or SharePoint link in ticket, If it does then ticket should remain in closed status or if this condition doesn’t match then ticket should be in push back to backlog status. 

I don’t know why, even I attached confluence link in comment and close the ticket the rule runs and it push back ticket to backlog instead of closed status.

Is there something I’m doing wrong? 

 

IMG_5011.png

IMG_5010.png

2 answers

1 vote
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 18, 2024

Hi @Bhumi Yadav -- Welcome to the Atlassian Community!

The smart value {{issue.comments}} is a list of values, each one with structure including the body, author, etc. of all the commentshttps://confluence.atlassian.com/automation/jira-smart-values-issues-993924860.html#Jirasmartvaluesissues-issue.commentsissue.comments

Are you trying to check for the text / links in all possible comments added for the issue, only the last comment, or something else?

Kind regards,
Bill

Bhumi Yadav July 24, 2024

Yes any links ( for eg if I comment down in ticket:- The task is complete (link) and add any link after it)

then rule should check if there is any link or not in comment section.

dont know I can’t I resolve it, not able to write down smart value for it. 

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 25, 2024

Could the URLs contain mixed case?  If so, perhaps force the comments to lower case before comparison.

Or, perhaps try using the match() function with your regular expression in the first value to evaluate all comments, and then test if any results are found.

{{issue.comments.body.split(" ").toLowercase().match("(https?://.*(confluence|sharepoint)\.com)")}}

Bhumi Yadav July 30, 2024

So I have a regex 

{{issue.comments.body.match("(http|https)://").size}}

but it didn’t work for short links 

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 31, 2024

Are you using Jira Cloud or Server / Data Center?  I believe that may impact the format of the link representation.

You can confirm the representation by writing the comment to the audit log to see the format of the smart link.  For example, this is what I see for Jira Cloud in a comment:

here is a comment with a URL [https://community.atlassian.com/|https://community.atlassian.com/|smart-link]

 

And so when I tested your expression:

{{issue.comments.body.match("(http|https)://").size}}

It doubles the count size.  Once you have an expression that works, you may want to add the list function distinct at the end to remove duplicates.

 

As you want this to also work with shortened links, my suggestion is to perform an internet search for example regular expressions to parse URLs, and then update that for your shortened URL syntax.  Then test thoroughly.

 

Bhumi Yadav July 31, 2024

Thanks definitely I’ll try it.  

0 votes
Nicolas Grossi
Banned
July 17, 2024

@Bhumi Yadav Welcome! I think the first condition "does not match" is the responsible for that?

 

Nicolas

Bhumi Yadav July 17, 2024

@Nicolas Grossi  It showing IF block condition passed, issue to BACKLOG,

but it should not pass I have confluence link added in comment. 
If I have link in comment then transition issue should CLOSED.

Not sure if my Regex is correct or not.

Bhumi Yadav July 17, 2024

@Nicolas Grossi 

When Issue Transistioned to Closed- Chech IF attachment is Empty or Not - If No- Ticket Remains Closed - IF Yes - Check comment if there is any url link present - No URL (then transition the issue to Backlog) - Yes (Ticket remains Closed) 

 

Suggest an answer

Log in or Sign up to answer