Allow Customers to reopen issues only within X issue not ingnoring the if block
Asked by Pieter Van Der Merwe:

Good day Everyone,

I am stuck with the Automation implementation of the "Allow Customers to reopen...". My Problem that I am facing, is that the Automation works but it sortof ignores the if block that states " If: Matches resolved less that 5 days it will open the ticket again, however the ticket still gets opened even if the ticket is older that 5 days.

Is there anything that I am missing to why it opens tickets older than 5 days aswell?

This is the document that I followed to implement:

[Allow Customers to reopen issues only within X days from resolution \| Jira \| Atlassian Documentation](https://confluence.atlassian.com/jirakb/allow-customers-to-reopen-issues-only-within-x-days-from-resolution-1223820569.html)

The automation rule:

![Screenshot 2024-06-21 114838.png](/t5/image/serverpage/image-id/331070iF4C959F66DBE85F8/image-size/large?v=v2&px=999 "Screenshot 2024-06-21 114838.png")

Thank you very much in advance.

Warm regards,

Pieter


Answers:
author: Pieter Van Der Merwe
body: Hi Everyone,

Just an update anyone else having the same problem: We simply updated this string instead of {{now.diff(issue.resolved).days.abs}} we used {{now.diff(issue.resolutionDate).days.abs}}

Hope this helps.


author: Jovin
body: Hey [@Pieter Van Der Merwe](/t5/user/viewprofilepage/user-id/5323616)

Can I recommend a slight adjustment to your approach? I would recommend creating another status after your completed status that indicates the closure of the ticket - for the purposes of this exercise I'll call the completed status "Complete" and the closed status "Closed".

1. Update your workflow to have another status called "Closed", it should only have 1 transition available - FROM Completed TO Closed
   1. You can optionally make the ticket read only if you use Jira properties, which I'll place right at the end of this comment.
   2. Place a condition on the transition from completed to closed of type "User is in project role" and choose "atlassian-addons-project-access".
2. Create a new SLA called "Time to close after resolution" and configure the SLA to have 5 days. Make sure you use the appropriate calendar for your use - if you have a 24x7 calendar this would mean 120h, if you have a 9-5 calendar, this would be 40h.
   1. Start counting when: Entered status Completed
   2. Finish counting when: Entered status Closed, Resolution: Cleared (this second one lets it restart the counter when it's reopened).
3. Create a new Automation Rule called "Close issue after 5 days" and set it up like the below:
   1. DETAILS: Ensure the actor is Automation for Jira
   2. TRIGGER: SLA threshold breached  
      1. SLA: "Time to close after resolution"
      2. Trigger when SLA has: choose your preferred one - I go with breached
   3. THEN: Add an action: Transition issue
      1. Destination status: Closed
4. Modify your existing automation rule for reopening, call it "Reopen issue on customer comment", set it up like below:
   1. TRIGGER: Issue commented
      1. Comment type: All comments
   2. THEN: Add an action: Transition issue
      1. Destination status: Work in progress (or whatever your in progress status is called).

This configuration will:

* Automatically make tickets become "Closed", after 5 days, preventing reopening
  * You can also see how long until it becomes closed via the issue view
* Allow reopening of tickets

Now, to provide the "read only" status properties if you want it. On your workflow, select the "Closed" status and click "Properties", then add the below two:

* Property 1: No comments
  * Key: jira.permission.comment.denied
  * Value: true
* Property 2: Read Only (no edits)
  * Key: jira.permission.edit.denied
  * Value: true

comments: author: Pieter Van Der Merwe
body: Hallo Jovin,

Thank you so much for taking the time to reply and for the wonderful response. That said, the Automation for this is already documented and I am merly trying to find why its not working.

Again your approach will help in the future and will also help alot of others as well.


author: Pieter Van Der Merwe
body: We got it working


Tags: cloud

jira-service-management

jira-service-management-cloud