Forums

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

Jira Service Desk - Comment based on lookupIssue automation rule

Jonathan Lewis November 12, 2024

Hello Atlassian Community,

 

 

I have an automation rule currently running to check for any duplicate tickets using the Lookup issues JQL which I had sorted from this previous post

project = "PSP" AND issuetype = "Service Request" AND "Customer Request Type" = "Testing Ticket" AND status in ("Waiting For Support", "Pending", "Waiting For Customer") AND resolutiondate is EMPTY and summary ~"\"{{triggerIssue.summary}}\""

Current flow of the Automation works perfectly, see attached screenshot 1 (labelled SS1).


Problem:

I have a comment action in place but I would like it to do be more specific.

 

I would like to have a comment generated from my current Automation rule to include:

  • The Jira Ticket number which the duplication is based off
  • And the reporter name of the Jira Ticket number which the duplication is based off.

 

For example, 

Ticket number PSP-168 has been submitted to our queue and the summary = 0000000000 and the customer request type = Testing Ticket (see screenshot 2, labelled SS2).

I submit another ticket PSP-XYZ with summary = 0000000000 and the customer request type = Testing Ticket. The Automation in place already finds it as a duplicate and cancels it immediately.

I would like the comment generated on the duplicate ticket PSP-XYZ to say it is a duplication of ticket PSP-168 and to provide the reporter display name of PSP-168.

 

I currently have in the comment (see screenshot 3, labelled SS3 ):

{{#lookupIssues}} *{{key}} {{/}}

{{#lookupIssues}} *{{reporter.displayName}} {{/}}

But this displays the current PSP-XYZ and the previous PSP-168 (PSP-XYZ does have a strikethrough since its been cancelled) both with each reporter display name. If I add text before the {{key}} or {{reporter.displayName}}, it replicates this for both PSP-XYZ and PSP-168.


Is there a way to only reference the initial ticket PSP-168 from the lookup issue JQL I used earlier? 

Appreciate any help on this :) 

SS1 - JSD Auto flow current.pngSS2 - JSD queue 1.pngSS3 - JSD Comment 3.png

1 answer

1 accepted

0 votes
Answer accepted
Trudy Claspill
Community Champion
November 12, 2024

Hello @Jonathan Lewis 

Add the bold text to the JQL in your Lookup Issues action:

project = "PSP" AND issuetype = "Service Request" AND "Customer Request Type" = "Testing Ticket" AND status in ("Waiting For Support", "Pending", "Waiting For Customer") AND resolutiondate is EMPTY and summary ~"\"{{triggerIssue.summary}}\"" AND key != {{triggerIssue.key}}

That will exclude the trigger issue from the results set.

Jonathan Lewis November 12, 2024

Hello @Trudy Claspill 

Thank you for your response.

I've added AND key != {{triggerIssue.key}} into my JQL lookup but this has caused the automation rule to not pickup the duplication until the 3rd ticket attempt (so I have a ticket sitting to be completed and another submitted/2nd with the same summary but that 2nd one is not triggered as a duplicate, third ticket submitted is picked up as a duplicate).

Then the second ticket that was submitted is appearing on the comment as well as the reporter display name.

Same again happens for submitting more tickets with the same summary, it looks like it has to have 2 tickets in the queue before the duplication can be picked up?

See screenshot attached, {{key}} & {{reporter.displayName}} should only be showing in the green highlight and the red highlight will be the duplicate not show in the comment.

Thanks!

SS4 - JSD Comment.png

Trudy Claspill
Community Champion
November 12, 2024

Sorry, I missed saying that you also have to change the Condition after the Lookup to be greater than 0 rather than greater than 1 in order to get the email when the first duplicate is created. And I recommend that you change the smart value in that condition to

{{lookupIssues.size|0}}

Unexpected things can happen with the size attribute if no issues are found. The code |0 tells the condition to use size if it is not null and to use 0 if size is null.

Like Jonathan Lewis likes this
Jonathan Lewis November 13, 2024

Thanks @Trudy Claspill, this worked as expected!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events