Re: [rt-users] Limiting rt-crontool notifications to every n days?

2017-01-17 Thread Matt Zagrabelny
On Tue, Jan 17, 2017 at 1:24 PM, Alex Hall  wrote:
>  Did your JSON-like syntax for
> updating fields ever make it into core for 4.4.1?

Not yet.

-m


Re: [rt-users] Limiting rt-crontool notifications to every n days?

2017-01-17 Thread Matt Zagrabelny
Just download the .bin and move it into
/opt/rt4/lib/RT/Action/ModifyCustomField.pm

-m

On Tue, Jan 17, 2017 at 1:24 PM, Alex Hall  wrote:
> Thank you, that looks like it'll work. Did your JSON-like syntax for
> updating fields ever make it into core for 4.4.1? I found the attachment in
> your linked message, but it's a bin file and I'm not sure what to do with
> it.
>
> On Tue, Jan 17, 2017 at 11:17 AM, Matt Zagrabelny 
> wrote:
>>
>> Hey Alex,
>>
>> On Mon, Jan 16, 2017 at 8:18 AM, Alex Hall  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
>> notifications.
>>
>> 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:
>>
>>
>> http://lists.bestpractical.com/pipermail/rt-devel/2016-December/012601.html
>>
>> 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" }'
>>
>> -m
>
>
>
>
> --
> Alex Hall
> Automatic Distributors, IT department
> ah...@autodist.com


Re: [rt-users] Limiting rt-crontool notifications to every n days?

2017-01-17 Thread Alex Hall
Thank you, that looks like it'll work. Did your JSON-like syntax for
updating fields ever make it into core for 4.4.1? I found the attachment in
your linked message, but it's a bin file and I'm not sure what to do with
it.

On Tue, Jan 17, 2017 at 11:17 AM, Matt Zagrabelny 
wrote:

> Hey Alex,
>
> On Mon, Jan 16, 2017 at 8:18 AM, Alex Hall  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
> notifications.
>
> 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:
>
> http://lists.bestpractical.com/pipermail/rt-devel/2016-
> December/012601.html
>
> 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" }'
>
> -m
>



-- 
Alex Hall
Automatic Distributors, IT department
ah...@autodist.com


Re: [rt-users] Limiting rt-crontool notifications to every n days?

2017-01-17 Thread Matt Zagrabelny
Hey Alex,

On Mon, Jan 16, 2017 at 8:18 AM, Alex Hall  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
notifications.

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:

http://lists.bestpractical.com/pipermail/rt-devel/2016-December/012601.html

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" }'

-m