Keeping the "Closed" date accurate for re-opened tickets

I’m working on a get of Condition/Action modules to fork tickets that are marked Resolved after a certain amount of time. I’m starting with the forking of a ticket using this code as a base:

I have the code working that the ticket gets forked properly. However, I’m working on setting the Closed date to its original. When I look at the Transaction Wiki page, it states that a “Set” transaction applies to dates. In my Action code, when I dump all (or what I believe to be all) of the transactions, I don’t see any Set types or any reference to setting the Closed date. My current idea is to search the Transactions for Status changes, and locate those that move “to resolved” and then use that Transaction date as the Closed date. Is this the only possible way to find the dates? Should there be Set information in the Transaction list?


I’m not sure I understand the problem, but I think this is just a terminology gap: the name of the “Close date” (in RT code and docs) is “Resolved”. So you need the to read the original ticket’s “Closed date”.

And you can set the close date of the forked ticket by SetResolved

Hope it helps.


This is the issue we’re having:

Say a ticket was closed today. It’s Resolved date gets set to 8/24/17 at XX:XX. Fast forward a month. The user re-opens the ticket & we resolve it again. Resolved now gets overwritten with the new date, and old date is lost. What I’m trying to do is find a way to get the original/first resolved date/time stamp. Thus far, the only way I’ve found to do it is to search the Transaction history for the earliest instance of “to ‘resolved’” and used that for the date/time stamp. The comment about the Set was I was hoping there was a record of what the original date was. I’m trying to code a 7 day period fot a ticket to be reopened. After that, it forks the ticket. The plug in I found in the Extension repository only appears to work for email, but not if someone does it via the web interface.

OK, I got it now. So I think you are right: your way is the only way, since there is no such a Set transaction for “close” event in the transaction history. (You can check it in the datebase in a minute.)

At least last time I worked with “Resolved” that was the case.

That’s fine :slight_smile: I just wanted to make sure I’m going down the right rabbit hole with my coding. :slight_smile: