Hey Alex,

On Mon, Jan 16, 2017 at 8:18 AM, Alex Hall <ah...@autodist.com> wrote:
> Hi all,
> RT is sending out notifications for old tickets just like we want it to. If
> a ticket hasn't been updated in seven days and the status is open or new,
> the owner gets an email every weekday until the ticket is updated. What I'd
> like to do, though, is have a way of changing that "every weekday" bit for
> stalled tickets.
> Instead of warning users every weekday about tickets that are stalled and
> haven't been touched in a while, I'd like to warn them once or twice a week.
> I can't run the cron job that seldom, though, or a ticket could go days
> longer than it should without being picked up. Is there any way to only send
> an email to a user if the system has not emailed them in N days? I could add
> a column to the Tickets table for this, or add a new table, but I always
> like to stay clear of database schema modifications if I can. Besides, I
> don't know how to interface with a custom table using RT SQL.

I wouldn't alter the schema.

> Is there any way of doing this?

You could use a custom field. Something like "Last Email Notification
Sent At" or something equally verbose. ;)

Then add that CF to your query about which tickets need to get email

We do essentially what you are asking about. We leverage two things:

1. rt-crontool can take multiple --action arguments
2. A custom (but it could be "cored") scrip action. The scrip action
is ModifyCustomField. Here is a link to it:


Here is one of our cron jobs that keeps track of when it sent an email
and also sends the email:

0 12 * * * /opt/rt4/bin/rt-crontool --log=warning --search
RT::Search::FromSQL --search-arg ' Queue = "Access Requests" AND
Status = "activated" AND ( ( "CF.{Renewal Verified At}" IS NULL AND
Created <= "1 year ago" ) OR ( "CF.{Renewal Verified At}" IS NOT NULL
AND "CF.{Renewal Verified At}" <= "1 year ago" ) ) AND ( "CF.{Renewal
Verification Sent At}" IS NULL OR "CF.{Renewal Verification Sent At}"
<= "20 days ago" ) ' --transaction-type Create --transaction last
--template "Access Request Renewal Verification" --action
RT::Action::MailRequestors --action-arg "" --action
RT::Action::ModifyCustomField --action-arg '{ "name": "Renewal
Verification Sent At", "operation": "set", "value": "now" }'


Reply via email to