Automatic reply request

First of all I’m new in the forum so if this topic is duplicated or has already an answer, please forgiveme and link me to the existig one.
Thank you.

I’m trying to create a custom script that follows the the bellow logic:
Ticket Owner = True && Ticket Status = Open

Owner sends a reply to Requestor.
IF after 3 days no answer from requestor is received THEN send email reminder to Requestor.
ELIF after 3 days from reminder no answer is received THEN Ticket Status = Closed/Resolved.

The days value should be variable from 3 to 7 depending on what the owner of the ticket decides.

I’m not familiar with the RT script syntax, could someone help me?

Thank you in advance

This is kind of tricky. I think the easiest way is to have a status like “waiting” that the ticket gets set to either manually or automatically when the owner sends a reply to the requestor.

You could also try adding some custom field of date type “Auto reminder due” or something then use the rt-crontool to schedule a daily job to look for tickets that are status waiting and “auto reminder due” is today to send some email

1 Like

I think you could probably do it without adding a new status to the lifecycle if you didn’t want to add one, but I think the idea of having custom fields is worth pursuing. You might just be able to get away with just one scrip and, as @knation says, the use of rt-crontool to do the periodic checking for the need to send reminders and resolve tickets.

I’d suggest a “flag” custom field with states of “Awaiting Reply”, “Reminder Sent” and another “timeout” custom field that the owner can set to the number of days to wait. You then need one scrip (with “blank” output) that triggers on correspondence for tickets with owners that are open, have a non-zero timeout custom field and :

a) if the correspondence is an outgoing email from the owner, set the flag custom field to “Awaiting Reply” if it isn’t already set,

b) if the correspondence is an outgoing email and the flag is already set to “Awaiting Reply”, set the flag custom field to “Reminder Sent”,

c) if the correspondence is an incoming email (from the requestor if you wish) then clear the flag custom field.

You’ll then need to use two rt-crontool commands:

  1. search for open tickets with the flag set to “Reminder Sent” and the last update time earlier than “timeout” days ago. Set the matched tickets’ statuses to resolved.

  2. search for open tickets with the flag set to “Awaiting Reply” and the last update over “timeout” days ago. For matched tickets send a templated reminder email from the owner (which will trigger b) above to reset the flag custom field)

One thing I can see that might scupper this would be if the owner or other people interacted with the ticket whilst waiting for a reply, as that would change the last updated time on the ticket. If that’s the case you might want to use the “timeout” CF value to set a third custom field with an actual date for the rt-crontool to use as @knation suggested. You can reset this in the scrip in condition b) by adding the “timeout” value to the current date/time.

1 Like

Hello @knation & @GreenJimll,
Thank you both for the help…
Althugh I was looking for some help to translate the logical process into syntax, I wasn’t able to do so.

But you both gave me some ideas on how to resolve this.

Thank you very much.

The syntax for scrips in RT is effectively embedded Perl, so if you aren’t familiar with the language you might want to learn the basics of that first. There is a free online course you can use or several books are available (including the classic Learning Perl book).