Action to delay the Due Date

Dear folks,

I was wondering… is there a way I can delay (a fixed amount of time)
the Due Date on all tickets that match some criteria (like being in
stalled state)?
I was thinking of using rt-crontool for that task as a sort of way to
"park" tickets (a cron job that runs every hour and delays 1 hour all
stalled tickets).

Thanks!
BR/Pablo

I was wondering… is there a way I can delay (a fixed amount of time)
the Due Date on all tickets that match some criteria (like being in
stalled state)?
I was thinking of using rt-crontool for that task as a sort of way to
“park” tickets (a cron job that runs every hour and delays 1 hour all
stalled tickets).

Sounds like you want rt-crontool?
http://bestpractical.com/docs/rt/latest/rt-crontool.html
http://bestpractical.com/docs/rt/latest/automating_rt.html

-kevin

Yes, that’s what I thought!
But among the actions, I did not find any to change the due date (and neither in the two links )
Any hints on how to do that?

Thanks!
BR/PabloOn Mar 3, 2014 8:40 PM, Kevin Falcone falcone@bestpractical.com wrote:
On Fri, Feb 28, 2014 at 11:58:27AM +0100, Pablo Fernandez wrote:

I was wondering… is there a way I can delay (a fixed amount of time)
the Due Date on all tickets that match some criteria (like being in
stalled state)?
I was thinking of using rt-crontool for that task as a sort of way to
“park” tickets (a cron job that runs every hour and delays 1 hour all
stalled tickets).

Sounds like you want rt-crontool?
http://bestpractical.com/docs/rt/latest/rt-crontool.html
http://bestpractical.com/docs/rt/latest/automating_rt.html

-kevin

I was wondering… is there a way I can delay (a fixed amount of time)
the Due Date on all tickets that match some criteria (like being in
stalled state)?
I was thinking of using rt-crontool for that task as a sort of way to
“park” tickets (a cron job that runs every hour and delays 1 hour all
stalled tickets).

Sounds like you want rt-crontool?
rt-crontool - RT 5.0.5 Documentation - Best Practical
Automating rt - RT 5.0.5 Documentation - Best Practical

But among the actions, I did not find any to change the due date (and neither in the two links )
Any hints on how to do that?

You’ll have to provide your own action in
local/lib/RT/Action/CustomDueMunging.pm

Likely you want a Prepare of { return 1}; and then you’ll have your
real logic in Commit.

-kevin

Thanks for the hint… I was able to do what I needed.
I post here the contents of the local/lib/RT/Action/DelayDue.pm script,
for others that may need it:

package RT::Action::DelayDue;
use base ‘RT::Action’;

use strict;

#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 increase the ticket Due Date to the
argument provided in minutes.");
}

}}}

{{{ sub Prepare

sub Prepare {
# nothing to prepare
return 1;
}

}}}

sub Commit {
my $self = shift;
my $due = $self->TicketObj->DueObj();
if ($due->Unix() > 1) {
$due->AddSeconds( $self->Argument * 60 );
$self->TicketObj->SetDue($due->ISO);
}
}

RT::Base->_ImportOverlays();

1;

And a nice crontool that runs every hour:

/opt/rt3/bin/rt-crontool --search RT::Search::FromSQL --search-arg
“Queue = ‘z1-rt’ AND Status = ‘stalled’” --action RT::Action::DelayDue
–action-arg 60 --verbose

Hope it helps! Thanks again for the help!
BR/PabloOn 03/04/2014 08:40 PM, Kevin Falcone wrote:

On Mon, Mar 03, 2014 at 09:55:08PM +0000, Fernandez Pablo wrote:

On Mar 3, 2014 8:40 PM, Kevin Falcone falcone@bestpractical.com wrote:
On Fri, Feb 28, 2014 at 11:58:27AM +0100, Pablo Fernandez wrote:

I was wondering… is there a way I can delay (a fixed amount of time)
the Due Date on all tickets that match some criteria (like being in
stalled state)?
I was thinking of using rt-crontool for that task as a sort of way to
“park” tickets (a cron job that runs every hour and delays 1 hour all
stalled tickets).
Sounds like you want rt-crontool?
rt-crontool - RT 5.0.5 Documentation - Best Practical
Automating rt - RT 5.0.5 Documentation - Best Practical

But among the actions, I did not find any to change the due date (and neither in the two links )
Any hints on how to do that?
You’ll have to provide your own action in
local/lib/RT/Action/CustomDueMunging.pm

Likely you want a Prepare of { return 1}; and then you’ll have your
real logic in Commit.

-kevin

Due date delay works!
However, when I change the status from Stalled to Open, the due date
becomes again the original one. Is there a way to avoid it?

Cheers Andy2014-03-05 11:23 GMT+01:00 Pablo Fernandez pablo.fernandez@cscs.ch:

Thanks for the hint… I was able to do what I needed.
I post here the contents of the local/lib/RT/Action/DelayDue.pm script,
for others that may need it:


package RT::Action::DelayDue;
use base ‘RT::Action’;

use strict;

#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 increase the ticket Due Date to the argument
provided in minutes.");
}

}}}

{{{ sub Prepare

sub Prepare {
# nothing to prepare
return 1;
}

}}}

sub Commit {
my $self = shift;
my $due = $self->TicketObj->DueObj();
if ($due->Unix() > 1) {
$due->AddSeconds( $self->Argument * 60 );
$self->TicketObj->SetDue($due->ISO);
}
}

RT::Base->_ImportOverlays();

1;

And a nice crontool that runs every hour:

/opt/rt3/bin/rt-crontool --search RT::Search::FromSQL --search-arg “Queue
= ‘z1-rt’ AND Status = ‘stalled’” --action RT::Action::DelayDue
–action-arg 60 --verbose

Hope it helps! Thanks again for the help!
BR/Pablo

On 03/04/2014 08:40 PM, Kevin Falcone wrote:

On Mon, Mar 03, 2014 at 09:55:08PM +0000, Fernandez Pablo wrote:

On Mar 3, 2014 8:40 PM, Kevin Falcone falcone@bestpractical.com falcone@bestpractical.com wrote:
On Fri, Feb 28, 2014 at 11:58:27AM +0100, Pablo Fernandez wrote:

I was wondering… is there a way I can delay (a fixed amount of time)
the Due Date on all tickets that match some criteria (like being in
stalled state)?
I was thinking of using rt-crontool for that task as a sort of way to
“park” tickets (a cron job that runs every hour and delays 1 hour all
stalled tickets).

Sounds like you want rt-crontool?http://bestpractical.com/docs/rt/latest/rt-crontool.htmlhttp://bestpractical.com/docs/rt/latest/automating_rt.html

But among the actions, I did not find any to change the due date (and neither in the two links )
Any hints on how to do that?

You’ll have to provide your own action in
local/lib/RT/Action/CustomDueMunging.pm

Likely you want a Prepare of { return 1}; and then you’ll have your
real logic in Commit.

-kevin


RT Training London, March 19-20 and Dallas May 20-21
http://bestpractical.com/training

My fault, there was a conflict with the SLA extension. I disabled it and it
works.2014-03-17 12:02 GMT+01:00 Andrea Zimmerli mangialatorre@gmail.com:

Due date delay works!
However, when I change the status from Stalled to Open, the due date
becomes again the original one. Is there a way to avoid it?

Cheers Andy

2014-03-05 11:23 GMT+01:00 Pablo Fernandez pablo.fernandez@cscs.ch:

Thanks for the hint… I was able to do what I needed.
I post here the contents of the local/lib/RT/Action/DelayDue.pm script,
for others that may need it:


package RT::Action::DelayDue;
use base ‘RT::Action’;

use strict;

#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 increase the ticket Due Date to the argument
provided in minutes.");
}

}}}

{{{ sub Prepare

sub Prepare {
# nothing to prepare
return 1;
}

}}}

sub Commit {
my $self = shift;
my $due = $self->TicketObj->DueObj();
if ($due->Unix() > 1) {
$due->AddSeconds( $self->Argument * 60 );
$self->TicketObj->SetDue($due->ISO);
}
}

RT::Base->_ImportOverlays();

1;

And a nice crontool that runs every hour:

/opt/rt3/bin/rt-crontool --search RT::Search::FromSQL --search-arg “Queue
= ‘z1-rt’ AND Status = ‘stalled’” --action RT::Action::DelayDue
–action-arg 60 --verbose

Hope it helps! Thanks again for the help!
BR/Pablo

On 03/04/2014 08:40 PM, Kevin Falcone wrote:

On Mon, Mar 03, 2014 at 09:55:08PM +0000, Fernandez Pablo wrote:

On Mar 3, 2014 8:40 PM, Kevin Falcone falcone@bestpractical.com falcone@bestpractical.com wrote:
On Fri, Feb 28, 2014 at 11:58:27AM +0100, Pablo Fernandez wrote:

I was wondering… is there a way I can delay (a fixed amount of time)
the Due Date on all tickets that match some criteria (like being in
stalled state)?
I was thinking of using rt-crontool for that task as a sort of way to
“park” tickets (a cron job that runs every hour and delays 1 hour all
stalled tickets).

Sounds like you want rt-crontool?http://bestpractical.com/docs/rt/latest/rt-crontool.htmlhttp://bestpractical.com/docs/rt/latest/automating_rt.html

But among the actions, I did not find any to change the due date (and neither in the two links )
Any hints on how to do that?

You’ll have to provide your own action in
local/lib/RT/Action/CustomDueMunging.pm

Likely you want a Prepare of { return 1}; and then you’ll have your
real logic in Commit.

-kevin


RT Training London, March 19-20 and Dallas May 20-21
http://bestpractical.com/training