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

Automation - Close tickets based on new and existing tickets

Supakij Ngamwongpaiboon April 29, 2021

Hi All,

I am trying to create an automation for a certain scenario, but I am having trouble navigating the click and build style of rule creation. 

The scenario here is that we create tickets based on the contents of an email if sent to a specific alias. We also receive automated health check report emails to said alias. So what I am having trouble navigating is to create automation for the following scneario:

  1. Email comes in with Summary - "Report #0001 - Open" 
  2. Email comes in with Summary - "Report #0001 - Close" 
  3. Automatically close both tickets "Report #0001 - Open" and "Report #0001 - Close"

And another scenario, just in general, is to close a ticket based on the Summary itself if titled "Close this" when coming in. 

Also please let me know if that scenario is possible to automate in general,

Thanks!

1 answer

1 accepted

1 vote
Answer accepted
Earl McCutcheon
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 3, 2021

Hello @Supakij Ngamwongpaiboon ,

Thanks for reaching out and I believe I came up with a method that will meet these criteria.

First, to verify if I understand the workflow correctly it will flow as follows:

  1. The initial issue is created with an email using an automatically generated summary matching the format:
    1. "Report #XXXX - Open"
  2. Actions are performed on the initial issue disconnected from the automation rules
  3. When ready to close out the issue a secondary issue is created via email with a summary matching the format:
    1. "Report #XXXX - Closed"
    2. Where XXXX is the matching report number to the initial issue with the Open flag
  4. When The secondary issue is created with the Closed tag in the summary no action is taken on the secondary issue other than triggering an automation rule to close out the initial issue with the Open Tag

If I read this correctly the following Rule should do the trick,  and for a reference point, I am using concepts from the following documentation:

The rule flows as follows noting I added in a few Optional sanity check via comments to verify successful and failed operations:

  • When: Issue Created
  • Then: Create Variable
    • Variable name: 
      • OriginSummary
    • Smart value:
      • {{issue.summary.left(12)}}
      • NOTE:  If the XXXX value goes beyond 4 numerical values the rule will need to be adjusted to compensate for the increased number format.  I lined these values up with the "Report #0001" - Open/Closed from your description
  • If: Matches
    • JQL condition:
      • summary ~ "{{OriginSummary}}" AND summary ~ "Closed"
    • Branch Rule: For JQL
      • Type of related issues:
        • JQL 
      • JQL:
        • summary ~ "{{OriginSummary}}" and summary ~ "Open"
        • Deselect the option for "Only include issues that have changed since the last time this rule executed"
      • Then: Link issue to:
        • This issue:
          • Causes
        • Issue:
          • Trigger Issue
      • AND: Transition the Issue to:
        • Destination Status:
          • Resolved (Example status) 
          • NOTE: Choose the desired resolution status per your workflow
    • Re-Fetch Issue data:
      • Verifies that the source issue data is indexed for follow up actions
    • Branch Rule: For Current Issue
      • OPTIONAL: Add Comment to issue
        • Comment
          • This Issue was automatically closed relating to the Linked issue
      • Then: Transition the issue to
        • Destination Status:
          • Resolved (Example status) 
          • NOTE: Choose the desired resolution status per your workflow
  • OPTIONAL: Else:
    • Then: Add Comment
      • Comment
        • The Automation Rule Failed on the "Else" operation please check the variable on the rule and the automation Audit log for errors, and manually close the issues as needed.
          The current Origin Summary variable used is: "{{OriginSummary}}"
        • Deselect the option for "Only include issues that have changed since the last time this rule executed"

Hope this helps out and is what you are looking for.  Let me know if you have any follow-up questions.

Regards,
Earl

Supakij Ngamwongpaiboon May 6, 2021

Hi @Earl McCutcheon ,

Thank you very much for your response, this was exactly what I was looking for. 

I am however running into an error in that it is not closing out the "Open" / "New"(first) ticket, while automation does close out the "Closed" / "Completed" (second) ticket successfully. 

image.png

 

Screenshot of the audit log of the error:

image.png

 

Here is how the rule is set up, please let me know if I have anything set up incorrectly that would be causing this issue.

  • The OriginSummary smart value is {{issue.summary.left(28)}}

image.png

  image.png

Earl McCutcheon
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 11, 2021

Hello @Supakij Ngamwongpaiboon ,

Thanks for all the details, and this one was throwing me for a loop for a while there too, as it seemed to be working on my end without issue in my test, However I was testing with slightly different syntax so after I aligned the syntax formatting I found the issue.

The JQL does not like the brackets "[" and "]" unless you close off the search as exact text vs approximate text for the search syntax.

If you modify the two JQL searches to the following the rule should work with the formatting including the brackets:

summary ~ "\"{{OriginSummary}}\"" AND summary ~ "Completed"

and

summary ~ "\"{{OriginSummary}}\"" and summary ~ "New"

Regards,
Earl

Supakij Ngamwongpaiboon May 24, 2021

That was exactly it - that fixed my issue. Thank you!

Like Earl McCutcheon likes this
itsmejira June 17, 2022

Is it possible to implement same automation rules in Jira Server? As Jira server is not having the smart variables option, any other way to do this?

Earl McCutcheon
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 23, 2022

Hello @itsmejira ,

Unfortunately, this action is available only in Jira Cloud at this time.

There's a feature request for Server and Data Center tracking interest in this at the following link, Make sure to add a vote to the request to help track continued interest:

Regards,
Earl

Suggest an answer

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

Atlassian Community Events