Auto-close tickets after X amount of time

I have a ton of tickets that get sent in, picked up by a staff member,
replied to with a suggestion, and then the requestor never takes the time to
write back and say “Thanks that worked” or “Its fixed” or anything like that
to let us know that the ticket can be closed. So what I’d like to do is set
something up so that if a ticket goes 48 hours without a reply from the
requestor (if the owner is not nobody and a reply has been made to the
requestor) then the ticket gets automatically closed. What would also be
nice would be if I could set it up such that an email was sent after 12
hours of no activity saying “If you don’t reply to this ticket in 36 hours,
it will automatically be closed.”

Anyone done anything like this?

I have…

In …/lib/Condition

#cat Idle.pm

Author: Ramon Kagan

Birth September 30, 2004 - 08:30 ESTEDT

This module checks the “idleness” of a ticket"

=head1 NAME

RT::Condition::Idle

=head1 DESCRIPTION

Returns true if the ticket we’re operating on has been idle
for the number of days specified

=cut

package RT::Condition::Idle;
require RT::Condition::Generic;

use strict;
use Time::ParseDate;
use vars qw/@ISA/;
@ISA = qw(RT::Condition::Generic);

=head2 IsApplicable

If the last modified date plus the number of days specified is before
"now" return true

=cut

sub IsApplicable {
my $self = shift;
my $seconds = $self->Argument * 86400;
$RT::Logger->debug(“Idle: Seconds is " . $seconds);
my $now = parsedate(“now”);
$RT::Logger->debug(“Idle: Now is " . $now);
my $lastdate = $self->TicketObj->LastUpdated;
my $last = parsedate(”$lastdate”);
$RT::Logger->debug("Idle: Last is " . $last);
if ($now - $last > $seconds) {
return(1);
}
else {
return(undef);
}
}

eval “require RT::Condition::Idle_Vendor”;
die $@ if ($@ && $@ !~ qr{^Can’t locate RT/Condition/Idle_Vendor.pm});
eval “require RT::Condition::Idle_Local”;
die $@ if ($@ && $@ !~ qr{^Can’t locate RT/Condition/Idle_Local.pm});

1;

in …/lib/SetStatus.pm

Author: Ramon Kagan

Birth September 8, 2004 - 08:30 ESTEDT

This module incorporates much of the SetPriority.pm from

Best Practical. It changes the status of the ticket as requested

package RT::Action::SetStatus;
require RT::Action::Generic;

use strict;
use vars qw/@ISA/;
@ISA=qw(RT::Action::Generic);

#Do what we need to do and send it out.

#What does this type of Action does

{{{ sub Describe

sub Describe {
my $self = shift;
return (ref $self . " will set a ticket’s status to the argument
provided.");
}

}}}

{{{ sub Prepare

sub Prepare {
# nothing to prepare
return 1;
}

}}}

sub Commit {
my $self = shift;
$self->TicketObj->SetStatus($self->Argument);

}

eval “require RT::Action::SetStatus_Vendor”;
die $@ if ($@ && $@ !~ qr{^Can’t locate RT/Action/SetStatus_Vendor.pm});
eval “require RT::Action::SetStatus_Local”;
die $@ if ($@ && $@ !~ qr{^Can’t locate RT/Action/SetStatus_Local.pm});

1;

Using crontool

rt-crontool --search RT::Search::ActiveTicketsInQueue --search-arg
–condition RT::Condition::Idle --condition-arg
–action RT::Action::SetStatus --action-arg

If you want to make this hours… change the 86400 in Idle.pm to 3600

Hope that helps.

Ramon Kagan
York University, Computing and Network Services
Information Security - Senior Information Security Analyst
(416)736-2100 #20263
rkagan@yorku.ca


I have not failed. I have just I don’t know the secret to success,
found 10,000 ways that don’t work. but the secret to failure is
trying to please everybody.
- Thomas Edison - Bill Cosby
----------------------------------- ------------------------------------On Mon, 14 Feb 2005, Jonathan Reeder wrote:

I have a ton of tickets that get sent in, picked up by a staff member,
replied to with a suggestion, and then the requestor never takes the time to
write back and say “Thanks that worked” or “Its fixed” or anything like that
to let us know that the ticket can be closed. So what I’d like to do is set
something up so that if a ticket goes 48 hours without a reply from the
requestor (if the owner is not nobody and a reply has been made to the
requestor) then the ticket gets automatically closed. What would also be
nice would be if I could set it up such that an email was sent after 12
hours of no activity saying “If you don’t reply to this ticket in 36 hours,
it will automatically be closed.”

Anyone done anything like this?

Sorry typo…

SetStatus.pm should be in …/lib/Action

Ramon Kagan
York University, Computing and Network Services
Information Security - Senior Information Security Analyst
(416)736-2100 #20263
rkagan@yorku.ca


I have not failed. I have just I don’t know the secret to success,
found 10,000 ways that don’t work. but the secret to failure is
trying to please everybody.
- Thomas Edison - Bill Cosby
----------------------------------- ------------------------------------On Mon, 14 Feb 2005, Ramon Kagan wrote:

I have…

In …/lib/Condition

#cat Idle.pm

Author: Ramon Kagan

Birth September 30, 2004 - 08:30 ESTEDT

This module checks the “idleness” of a ticket"

=head1 NAME

RT::Condition::Idle

=head1 DESCRIPTION

Returns true if the ticket we’re operating on has been idle
for the number of days specified

=cut

package RT::Condition::Idle;
require RT::Condition::Generic;

use strict;
use Time::ParseDate;
use vars qw/@ISA/;
@ISA = qw(RT::Condition::Generic);

=head2 IsApplicable

If the last modified date plus the number of days specified is before
"now" return true

=cut

sub IsApplicable {
my $self = shift;
my $seconds = $self->Argument * 86400;
$RT::Logger->debug(“Idle: Seconds is " . $seconds);
my $now = parsedate(“now”);
$RT::Logger->debug(“Idle: Now is " . $now);
my $lastdate = $self->TicketObj->LastUpdated;
my $last = parsedate(”$lastdate”);
$RT::Logger->debug("Idle: Last is " . $last);
if ($now - $last > $seconds) {
return(1);
}
else {
return(undef);
}
}

eval “require RT::Condition::Idle_Vendor”;
die $@ if ($@ && $@ !~ qr{^Can’t locate RT/Condition/Idle_Vendor.pm});
eval “require RT::Condition::Idle_Local”;
die $@ if ($@ && $@ !~ qr{^Can’t locate RT/Condition/Idle_Local.pm});

1;

in …/lib/SetStatus.pm

Author: Ramon Kagan

Birth September 8, 2004 - 08:30 ESTEDT

This module incorporates much of the SetPriority.pm from

Best Practical. It changes the status of the ticket as requested

package RT::Action::SetStatus;
require RT::Action::Generic;

use strict;
use vars qw/@ISA/;
@ISA=qw(RT::Action::Generic);

#Do what we need to do and send it out.

#What does this type of Action does

{{{ sub Describe

sub Describe {
my $self = shift;
return (ref $self . " will set a ticket’s status to the argument
provided.");
}

}}}

{{{ sub Prepare

sub Prepare {
# nothing to prepare
return 1;
}

}}}

sub Commit {
my $self = shift;
$self->TicketObj->SetStatus($self->Argument);

}

eval “require RT::Action::SetStatus_Vendor”;
die $@ if ($@ && $@ !~ qr{^Can’t locate RT/Action/SetStatus_Vendor.pm});
eval “require RT::Action::SetStatus_Local”;
die $@ if ($@ && $@ !~ qr{^Can’t locate RT/Action/SetStatus_Local.pm});

1;

Using crontool

rt-crontool --search RT::Search::ActiveTicketsInQueue --search-arg
–condition RT::Condition::Idle --condition-arg
–action RT::Action::SetStatus --action-arg

If you want to make this hours… change the 86400 in Idle.pm to 3600

Hope that helps.

Ramon Kagan
York University, Computing and Network Services
Information Security - Senior Information Security Analyst
(416)736-2100 #20263
rkagan@yorku.ca


I have not failed. I have just I don’t know the secret to success,
found 10,000 ways that don’t work. but the secret to failure is
trying to please everybody.

  • Thomas Edison - Bill Cosby

On Mon, 14 Feb 2005, Jonathan Reeder wrote:

I have a ton of tickets that get sent in, picked up by a staff member,
replied to with a suggestion, and then the requestor never takes the time to
write back and say “Thanks that worked” or “Its fixed” or anything like that
to let us know that the ticket can be closed. So what I’d like to do is set
something up so that if a ticket goes 48 hours without a reply from the
requestor (if the owner is not nobody and a reply has been made to the
requestor) then the ticket gets automatically closed. What would also be
nice would be if I could set it up such that an email was sent after 12
hours of no activity saying “If you don’t reply to this ticket in 36 hours,
it will automatically be closed.”

Anyone done anything like this?


http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

RT Administrator and Developer training is coming to your town soon! (Boston, San Francisco, Austin, Sydney) Contact training@bestpractical.com for details.

Be sure to check out the RT Wiki at http://wiki.bestpractical.com

VERY helpful, thanks a lot.From: Ramon Kagan [mailto:rkagan@yorku.ca]
Sent: Monday, February 14, 2005 11:03 AM
To: Jonathan Reeder
Cc: rt-users@lists.bestpractical.com
Subject: Re: [rt-users] auto-close tickets after X amount of time

Sorry typo…

SetStatus.pm should be in …/lib/Action

Ramon Kagan
York University, Computing and Network Services
Information Security - Senior Information Security Analyst
(416)736-2100 #20263
rkagan@yorku.ca


I have not failed. I have just I don’t know the secret to success,
found 10,000 ways that don’t work. but the secret to failure is
trying to please everybody.
- Thomas Edison - Bill Cosby


I have…

In …/lib/Condition

#cat Idle.pm

Author: Ramon Kagan

Birth September 30, 2004 - 08:30 ESTEDT

This module checks the “idleness” of a ticket"

=head1 NAME

RT::Condition::Idle

=head1 DESCRIPTION

Returns true if the ticket we’re operating on has been idle
for the number of days specified

=cut

package RT::Condition::Idle;
require RT::Condition::Generic;

use strict;
use Time::ParseDate;
use vars qw/@ISA/;
@ISA = qw(RT::Condition::Generic);

=head2 IsApplicable

If the last modified date plus the number of days specified is before
"now" return true

=cut

sub IsApplicable {
my $self = shift;
my $seconds = $self->Argument * 86400;
$RT::Logger->debug(“Idle: Seconds is " . $seconds);
my $now = parsedate(“now”);
$RT::Logger->debug(“Idle: Now is " . $now);
my $lastdate = $self->TicketObj->LastUpdated;
my $last = parsedate(”$lastdate”);
$RT::Logger->debug("Idle: Last is " . $last);
if ($now - $last > $seconds) {
return(1);
}
else {
return(undef);
}
}

eval “require RT::Condition::Idle_Vendor”;
die $@ if ($@ && $@ !~ qr{^Can’t locate RT/Condition/Idle_Vendor.pm});
eval “require RT::Condition::Idle_Local”;
die $@ if ($@ && $@ !~ qr{^Can’t locate RT/Condition/Idle_Local.pm});

1;

in …/lib/SetStatus.pm

Author: Ramon Kagan

Birth September 8, 2004 - 08:30 ESTEDT

This module incorporates much of the SetPriority.pm from

Best Practical. It changes the status of the ticket as requested

package RT::Action::SetStatus;
require RT::Action::Generic;

use strict;
use vars qw/@ISA/;
@ISA=qw(RT::Action::Generic);

#Do what we need to do and send it out.

#What does this type of Action does

{{{ sub Describe

sub Describe {
my $self = shift;
return (ref $self . " will set a ticket’s status to the argument
provided.");
}

}}}

{{{ sub Prepare

sub Prepare {
# nothing to prepare
return 1;
}

}}}

sub Commit {
my $self = shift;
$self->TicketObj->SetStatus($self->Argument);

}

eval “require RT::Action::SetStatus_Vendor”;
die $@ if ($@ && $@ !~ qr{^Can’t locate RT/Action/SetStatus_Vendor.pm});
eval “require RT::Action::SetStatus_Local”;
die $@ if ($@ && $@ !~ qr{^Can’t locate RT/Action/SetStatus_Local.pm});

1;

Using crontool

rt-crontool --search RT::Search::ActiveTicketsInQueue --search-arg
–condition RT::Condition::Idle --condition-arg
–action RT::Action::SetStatus --action-arg

If you want to make this hours… change the 86400 in Idle.pm to 3600

Hope that helps.

Ramon Kagan
York University, Computing and Network Services
Information Security - Senior Information Security Analyst
(416)736-2100 #20263
rkagan@yorku.ca


I have not failed. I have just I don’t know the secret to success,
found 10,000 ways that don’t work. but the secret to failure is
trying to please everybody.

  • Thomas Edison - Bill Cosby

I have a ton of tickets that get sent in, picked up by a staff member,
replied to with a suggestion, and then the requestor never takes the
time to

write back and say “Thanks that worked” or “Its fixed” or anything like
that

to let us know that the ticket can be closed. So what I’d like to do is
set

something up so that if a ticket goes 48 hours without a reply from the
requestor (if the owner is not nobody and a reply has been made to the
requestor) then the ticket gets automatically closed. What would also
be

nice would be if I could set it up such that an email was sent after 12
hours of no activity saying "If you don’t reply to this ticket in 36
hours,

it will automatically be closed."

Anyone done anything like this?


http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

RT Administrator and Developer training is coming to your town soon!
(Boston, San Francisco, Austin, Sydney) Contact training@bestpractical.com
for details.

Be sure to check out the RT Wiki at http://wiki.bestpractical.com

Ramon,

I’ve successfully implemented the resolve after 48 hours of inactivity part
of what I want to do. Now in order to get the notification to the user that
"This ticket will be close if not updated in 24 hours", I’m basically going
to copy the same rt-crontool command, except the action will be
RecordCorrespondence instead of SetStatus. If I’m correct in my thinking
though, I’m worried that the actual act of sending them the correspondence
will set a new LastUpdated, and as such I’ll never actually reach the 48
hours of idle and close the ticket. Here’s what I was planning on
eventually having in my crontab:

10 * * * * rt-crontool --search
RT::Search::ActiveTicketsInQueue --search-arg --condition
RT::Condition::Idle --condition-arg 48 --action
RT::Action::SetStatus --action-arg resolved

5 * * * * rt-crontool --search RT::Search::ActiveTicketsInQueue --search-arg
--condition RT::Condition::Idle --condition-arg 24 --action
RT::Action::RecordCorrespondence --template ‘Expiring Tickets’

Would this just send the ‘Expiring Tickets’ template every 24 hours over and
over again, without ever reaching the 48 hours set in the SetStatus rule?
I’m wondering if I should modify Idle.pm a bit so looks only at the last
update by the requestor, not just any update?

Thanks again for the modules, I’ve already got the first part up and
running.

JonathanFrom: Ramon Kagan [mailto:rkagan@yorku.ca]
Sent: Monday, February 14, 2005 11:03 AM
To: Jonathan Reeder
Cc: rt-users@lists.bestpractical.com
Subject: Re: [rt-users] auto-close tickets after X amount of time

Sorry typo…

SetStatus.pm should be in …/lib/Action

Ramon Kagan
York University, Computing and Network Services
Information Security - Senior Information Security Analyst
(416)736-2100 #20263
rkagan@yorku.ca


I have not failed. I have just I don’t know the secret to success,
found 10,000 ways that don’t work. but the secret to failure is
trying to please everybody.
- Thomas Edison - Bill Cosby


I have…

In …/lib/Condition

#cat Idle.pm

Author: Ramon Kagan

Birth September 30, 2004 - 08:30 ESTEDT

This module checks the “idleness” of a ticket"

=head1 NAME

RT::Condition::Idle

=head1 DESCRIPTION

Returns true if the ticket we’re operating on has been idle
for the number of days specified

=cut

package RT::Condition::Idle;
require RT::Condition::Generic;

use strict;
use Time::ParseDate;
use vars qw/@ISA/;
@ISA = qw(RT::Condition::Generic);

=head2 IsApplicable

If the last modified date plus the number of days specified is before
"now" return true

=cut

sub IsApplicable {
my $self = shift;
my $seconds = $self->Argument * 86400;
$RT::Logger->debug(“Idle: Seconds is " . $seconds);
my $now = parsedate(“now”);
$RT::Logger->debug(“Idle: Now is " . $now);
my $lastdate = $self->TicketObj->LastUpdated;
my $last = parsedate(”$lastdate”);
$RT::Logger->debug("Idle: Last is " . $last);
if ($now - $last > $seconds) {
return(1);
}
else {
return(undef);
}
}

eval “require RT::Condition::Idle_Vendor”;
die $@ if ($@ && $@ !~ qr{^Can’t locate RT/Condition/Idle_Vendor.pm});
eval “require RT::Condition::Idle_Local”;
die $@ if ($@ && $@ !~ qr{^Can’t locate RT/Condition/Idle_Local.pm});

1;

in …/lib/SetStatus.pm

Author: Ramon Kagan

Birth September 8, 2004 - 08:30 ESTEDT

This module incorporates much of the SetPriority.pm from

Best Practical. It changes the status of the ticket as requested

package RT::Action::SetStatus;
require RT::Action::Generic;

use strict;
use vars qw/@ISA/;
@ISA=qw(RT::Action::Generic);

#Do what we need to do and send it out.

#What does this type of Action does

{{{ sub Describe

sub Describe {
my $self = shift;
return (ref $self . " will set a ticket’s status to the argument
provided.");
}

}}}

{{{ sub Prepare

sub Prepare {
# nothing to prepare
return 1;
}

}}}

sub Commit {
my $self = shift;
$self->TicketObj->SetStatus($self->Argument);

}

eval “require RT::Action::SetStatus_Vendor”;
die $@ if ($@ && $@ !~ qr{^Can’t locate RT/Action/SetStatus_Vendor.pm});
eval “require RT::Action::SetStatus_Local”;
die $@ if ($@ && $@ !~ qr{^Can’t locate RT/Action/SetStatus_Local.pm});

1;

Using crontool

rt-crontool --search RT::Search::ActiveTicketsInQueue --search-arg
–condition RT::Condition::Idle --condition-arg
–action RT::Action::SetStatus --action-arg

If you want to make this hours… change the 86400 in Idle.pm to 3600

Hope that helps.

Ramon Kagan
York University, Computing and Network Services
Information Security - Senior Information Security Analyst
(416)736-2100 #20263
rkagan@yorku.ca


I have not failed. I have just I don’t know the secret to success,
found 10,000 ways that don’t work. but the secret to failure is
trying to please everybody.

  • Thomas Edison - Bill Cosby

I have a ton of tickets that get sent in, picked up by a staff member,
replied to with a suggestion, and then the requestor never takes the
time to

write back and say “Thanks that worked” or “Its fixed” or anything like
that

to let us know that the ticket can be closed. So what I’d like to do is
set

something up so that if a ticket goes 48 hours without a reply from the
requestor (if the owner is not nobody and a reply has been made to the
requestor) then the ticket gets automatically closed. What would also
be

nice would be if I could set it up such that an email was sent after 12
hours of no activity saying "If you don’t reply to this ticket in 36
hours,

it will automatically be closed."

Anyone done anything like this?


http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

RT Administrator and Developer training is coming to your town soon!
(Boston, San Francisco, Austin, Sydney) Contact training@bestpractical.com
for details.

Be sure to check out the RT Wiki at http://wiki.bestpractical.com

Hi,

I would suggest using a scrip that on condition change status to "closed"
by the “system user” (which would be the case), to send a notification
using you desired template. It would occur after the set status is
complete.

Just a thought, if I read your email correctly.

Ramon Kagan
York University, Computing and Network Services
Information Security - Senior Information Security Analyst
(416)736-2100 #20263
rkagan@yorku.ca


I have not failed. I have just I don’t know the secret to success,
found 10,000 ways that don’t work. but the secret to failure is
trying to please everybody.
- Thomas Edison - Bill Cosby
----------------------------------- ------------------------------------On Mon, 14 Feb 2005, Jonathan Reeder wrote:

Ramon,

I’ve successfully implemented the resolve after 48 hours of inactivity part
of what I want to do. Now in order to get the notification to the user that
"This ticket will be close if not updated in 24 hours", I’m basically going
to copy the same rt-crontool command, except the action will be
RecordCorrespondence instead of SetStatus. If I’m correct in my thinking
though, I’m worried that the actual act of sending them the correspondence
will set a new LastUpdated, and as such I’ll never actually reach the 48
hours of idle and close the ticket. Here’s what I was planning on
eventually having in my crontab:

10 * * * * rt-crontool --search
RT::Search::ActiveTicketsInQueue --search-arg --condition
RT::Condition::Idle --condition-arg 48 --action
RT::Action::SetStatus --action-arg resolved

5 * * * * rt-crontool --search RT::Search::ActiveTicketsInQueue --search-arg
--condition RT::Condition::Idle --condition-arg 24 --action
RT::Action::RecordCorrespondence --template ‘Expiring Tickets’

Would this just send the ‘Expiring Tickets’ template every 24 hours over and
over again, without ever reaching the 48 hours set in the SetStatus rule?
I’m wondering if I should modify Idle.pm a bit so looks only at the last
update by the requestor, not just any update?

Thanks again for the modules, I’ve already got the first part up and
running.

Jonathan

-----Original Message-----
From: Ramon Kagan [mailto:rkagan@yorku.ca]
Sent: Monday, February 14, 2005 11:03 AM
To: Jonathan Reeder
Cc: rt-users@lists.bestpractical.com
Subject: Re: [rt-users] auto-close tickets after X amount of time

Sorry typo…

SetStatus.pm should be in …/lib/Action

Ramon Kagan
York University, Computing and Network Services
Information Security - Senior Information Security Analyst
(416)736-2100 #20263
rkagan@yorku.ca


I have not failed. I have just I don’t know the secret to success,
found 10,000 ways that don’t work. but the secret to failure is
trying to please everybody.

  • Thomas Edison - Bill Cosby

On Mon, 14 Feb 2005, Ramon Kagan wrote:

I have…

In …/lib/Condition

#cat Idle.pm

Author: Ramon Kagan

Birth September 30, 2004 - 08:30 ESTEDT

This module checks the “idleness” of a ticket"

=head1 NAME

RT::Condition::Idle

=head1 DESCRIPTION

Returns true if the ticket we’re operating on has been idle
for the number of days specified

=cut

package RT::Condition::Idle;
require RT::Condition::Generic;

use strict;
use Time::ParseDate;
use vars qw/@ISA/;
@ISA = qw(RT::Condition::Generic);

=head2 IsApplicable

If the last modified date plus the number of days specified is before
"now" return true

=cut

sub IsApplicable {
my $self = shift;
my $seconds = $self->Argument * 86400;
$RT::Logger->debug(“Idle: Seconds is " . $seconds);
my $now = parsedate(“now”);
$RT::Logger->debug(“Idle: Now is " . $now);
my $lastdate = $self->TicketObj->LastUpdated;
my $last = parsedate(”$lastdate”);
$RT::Logger->debug("Idle: Last is " . $last);
if ($now - $last > $seconds) {
return(1);
}
else {
return(undef);
}
}

eval “require RT::Condition::Idle_Vendor”;
die $@ if ($@ && $@ !~ qr{^Can’t locate RT/Condition/Idle_Vendor.pm});
eval “require RT::Condition::Idle_Local”;
die $@ if ($@ && $@ !~ qr{^Can’t locate RT/Condition/Idle_Local.pm});

1;

in …/lib/SetStatus.pm

Author: Ramon Kagan

Birth September 8, 2004 - 08:30 ESTEDT

This module incorporates much of the SetPriority.pm from

Best Practical. It changes the status of the ticket as requested

package RT::Action::SetStatus;
require RT::Action::Generic;

use strict;
use vars qw/@ISA/;
@ISA=qw(RT::Action::Generic);

#Do what we need to do and send it out.

#What does this type of Action does

{{{ sub Describe

sub Describe {
my $self = shift;
return (ref $self . " will set a ticket’s status to the argument
provided.");
}

}}}

{{{ sub Prepare

sub Prepare {
# nothing to prepare
return 1;
}

}}}

sub Commit {
my $self = shift;
$self->TicketObj->SetStatus($self->Argument);

}

eval “require RT::Action::SetStatus_Vendor”;
die $@ if ($@ && $@ !~ qr{^Can’t locate RT/Action/SetStatus_Vendor.pm});
eval “require RT::Action::SetStatus_Local”;
die $@ if ($@ && $@ !~ qr{^Can’t locate RT/Action/SetStatus_Local.pm});

1;

Using crontool

rt-crontool --search RT::Search::ActiveTicketsInQueue --search-arg
–condition RT::Condition::Idle --condition-arg
–action RT::Action::SetStatus --action-arg

If you want to make this hours… change the 86400 in Idle.pm to 3600

Hope that helps.

Ramon Kagan
York University, Computing and Network Services
Information Security - Senior Information Security Analyst
(416)736-2100 #20263
rkagan@yorku.ca


I have not failed. I have just I don’t know the secret to success,
found 10,000 ways that don’t work. but the secret to failure is
trying to please everybody.
- Thomas Edison - Bill Cosby


On Mon, 14 Feb 2005, Jonathan Reeder wrote:

I have a ton of tickets that get sent in, picked up by a staff member,
replied to with a suggestion, and then the requestor never takes the
time to

write back and say “Thanks that worked” or “Its fixed” or anything like
that

to let us know that the ticket can be closed. So what I’d like to do is
set

something up so that if a ticket goes 48 hours without a reply from the
requestor (if the owner is not nobody and a reply has been made to the
requestor) then the ticket gets automatically closed. What would also
be

nice would be if I could set it up such that an email was sent after 12
hours of no activity saying "If you don’t reply to this ticket in 36
hours,

it will automatically be closed."

Anyone done anything like this?


http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

RT Administrator and Developer training is coming to your town soon!
(Boston, San Francisco, Austin, Sydney) Contact training@bestpractical.com
for details.

Be sure to check out the RT Wiki at http://wiki.bestpractical.com

I considered doing something along those lines, but what I was hoping to do
was give the user warning that his ticket would be closing before it
actually closed. So if I was going to close a ticket after 48 hours of
inactivity, I would send an email 24 hours into the 48 hours saying “This
ticket will close if not updated in 24 hours.”

The problem with that is that by sending the warning correspondence, the
ticket is no longer idle. I guess what I really need to do is one of two
things. Either I make it so that LastUpdated doesn’t get changed when I
send my warning correspondence, or I make it so that my condition (Idle)
doesn’t count the warning correspondence as something worth of resetting the
"idleness" of a ticket.From: Ramon Kagan [mailto:rkagan@yorku.ca]
Sent: Monday, February 14, 2005 12:43 PM
To: Jonathan Reeder
Cc: rt-users@lists.bestpractical.com
Subject: RE: [rt-users] auto-close tickets after X amount of time

Hi,

I would suggest using a scrip that on condition change status to "closed"
by the “system user” (which would be the case), to send a notification
using you desired template. It would occur after the set status is
complete.

Just a thought, if I read your email correctly.

Ramon Kagan
York University, Computing and Network Services
Information Security - Senior Information Security Analyst
(416)736-2100 #20263
rkagan@yorku.ca


I have not failed. I have just I don’t know the secret to success,
found 10,000 ways that don’t work. but the secret to failure is
trying to please everybody.
- Thomas Edison - Bill Cosby


Ramon,

I’ve successfully implemented the resolve after 48 hours of inactivity
part
of what I want to do. Now in order to get the notification to the user
that
"This ticket will be close if not updated in 24 hours", I’m basically
going
to copy the same rt-crontool command, except the action will be
RecordCorrespondence instead of SetStatus. If I’m correct in my thinking
though, I’m worried that the actual act of sending them the correspondence
will set a new LastUpdated, and as such I’ll never actually reach the 48
hours of idle and close the ticket. Here’s what I was planning on
eventually having in my crontab:

10 * * * * rt-crontool --search
RT::Search::ActiveTicketsInQueue --search-arg --condition
RT::Condition::Idle --condition-arg 48 --action
RT::Action::SetStatus --action-arg resolved

5 * * * * rt-crontool --search
RT::Search::ActiveTicketsInQueue --search-arg
--condition RT::Condition::Idle --condition-arg 24 --action
RT::Action::RecordCorrespondence --template ‘Expiring Tickets’

Would this just send the ‘Expiring Tickets’ template every 24 hours over
and
over again, without ever reaching the 48 hours set in the SetStatus rule?
I’m wondering if I should modify Idle.pm a bit so looks only at the last
update by the requestor, not just any update?

Thanks again for the modules, I’ve already got the first part up and
running.

Jonathan

-----Original Message-----
From: Ramon Kagan [mailto:rkagan@yorku.ca]
Sent: Monday, February 14, 2005 11:03 AM
To: Jonathan Reeder
Cc: rt-users@lists.bestpractical.com
Subject: Re: [rt-users] auto-close tickets after X amount of time

Sorry typo…

SetStatus.pm should be in …/lib/Action

Ramon Kagan
York University, Computing and Network Services
Information Security - Senior Information Security Analyst
(416)736-2100 #20263
rkagan@yorku.ca


I have not failed. I have just I don’t know the secret to success,
found 10,000 ways that don’t work. but the secret to failure is
trying to please everybody.

  • Thomas Edison - Bill Cosby

I have…

In …/lib/Condition

#cat Idle.pm

Author: Ramon Kagan

Birth September 30, 2004 - 08:30 ESTEDT

This module checks the “idleness” of a ticket"

=head1 NAME

RT::Condition::Idle

=head1 DESCRIPTION

Returns true if the ticket we’re operating on has been idle
for the number of days specified

=cut

package RT::Condition::Idle;
require RT::Condition::Generic;

use strict;
use Time::ParseDate;
use vars qw/@ISA/;
@ISA = qw(RT::Condition::Generic);

=head2 IsApplicable

If the last modified date plus the number of days specified is before
"now" return true

=cut

sub IsApplicable {
my $self = shift;
my $seconds = $self->Argument * 86400;
$RT::Logger->debug(“Idle: Seconds is " . $seconds);
my $now = parsedate(“now”);
$RT::Logger->debug(“Idle: Now is " . $now);
my $lastdate = $self->TicketObj->LastUpdated;
my $last = parsedate(”$lastdate”);
$RT::Logger->debug("Idle: Last is " . $last);
if ($now - $last > $seconds) {
return(1);
}
else {
return(undef);
}
}

eval “require RT::Condition::Idle_Vendor”;
die $@ if ($@ && $@ !~ qr{^Can’t locate RT/Condition/Idle_Vendor.pm});
eval “require RT::Condition::Idle_Local”;
die $@ if ($@ && $@ !~ qr{^Can’t locate RT/Condition/Idle_Local.pm});

1;

in …/lib/SetStatus.pm

Author: Ramon Kagan

Birth September 8, 2004 - 08:30 ESTEDT

This module incorporates much of the SetPriority.pm from

Best Practical. It changes the status of the ticket as requested

package RT::Action::SetStatus;
require RT::Action::Generic;

use strict;
use vars qw/@ISA/;
@ISA=qw(RT::Action::Generic);

#Do what we need to do and send it out.

#What does this type of Action does

{{{ sub Describe

sub Describe {
my $self = shift;
return (ref $self . " will set a ticket’s status to the argument
provided.");
}

}}}

{{{ sub Prepare

sub Prepare {
# nothing to prepare
return 1;
}

}}}

sub Commit {
my $self = shift;
$self->TicketObj->SetStatus($self->Argument);

}

eval “require RT::Action::SetStatus_Vendor”;
die $@ if ($@ && $@ !~ qr{^Can’t locate RT/Action/SetStatus_Vendor.pm});
eval “require RT::Action::SetStatus_Local”;
die $@ if ($@ && $@ !~ qr{^Can’t locate RT/Action/SetStatus_Local.pm});

1;

Using crontool

rt-crontool --search RT::Search::ActiveTicketsInQueue --search-arg

–condition RT::Condition::Idle --condition-arg
–action RT::Action::SetStatus --action-arg

If you want to make this hours… change the 86400 in Idle.pm to 3600

Hope that helps.

Ramon Kagan
York University, Computing and Network Services
Information Security - Senior Information Security Analyst
(416)736-2100 #20263
rkagan@yorku.ca


I have not failed. I have just I don’t know the secret to
success,

found 10,000 ways that don’t work. but the secret to failure is
trying to please everybody.
- Thomas Edison - Bill Cosby


I have a ton of tickets that get sent in, picked up by a staff member,
replied to with a suggestion, and then the requestor never takes the
time to

write back and say “Thanks that worked” or “Its fixed” or anything
like
that

to let us know that the ticket can be closed. So what I’d like to do
is
set

something up so that if a ticket goes 48 hours without a reply from
the

requestor (if the owner is not nobody and a reply has been made to the
requestor) then the ticket gets automatically closed. What would also
be

nice would be if I could set it up such that an email was sent after
12

hours of no activity saying "If you don’t reply to this ticket in 36
hours,

it will automatically be closed."

Anyone done anything like this?


http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

RT Administrator and Developer training is coming to your town soon!
(Boston, San Francisco, Austin, Sydney) Contact training@bestpractical.com
for details.

Be sure to check out the RT Wiki at http://wiki.bestpractical.com

Why dont you create a rule along the following lines

make a request close script, this will send out an email to the
requester stating that “We believe that your ticket was resolved to your
satisfaction, and this ticket will auto close in 24 hours if you do not
respond”

then 24 hours later this ticket closes itself as resolved. unless the
requester responds to the email with a do not close it email, if they
respond with request close then its closed immediately

Jonathan Reeder wrote: