Simple custom action question

Hey guys,

I want to create a simple scrip that changes the status of a ticket from
New to Open when someone Takes the ticket. The Custom Condition
should be similar to the On Steal example from RT Essentials:

my $trans = $self->TransactionObj;
return 0 unless $trans->Field eq ‘Owner’;
return 1 if $trans->OldValue == RT::Nobody()->id();
return 0;

So the Custom Action should just be a one-liner that changes the ticket
status. I was hoping to find an example of what that line would look
like but couldn’t find one. Thanks for any help!

–Andy

Andy Moran wrote:

Hey guys,

I want to create a simple scrip that changes the status of a ticket from
New to Open when someone Takes the ticket.

IIRC, the take action also opens the ticket. Are you talking about
manually changing owner?

The Custom Condition

should be similar to the On Steal example from RT Essentials:

my $trans = $self->TransactionObj;
return 0 unless $trans->Field eq ‘Owner’;
return 1 if $trans->OldValue == RT::Nobody()->id();
return 0;

So the Custom Action should just be a one-liner that changes the ticket
status. I was hoping to find an example of what that line would look
like but couldn’t find one. Thanks for any help!

–Andy


The rt-users Archives

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

Buy your copy of our new book, RT Essentials, today!

Download a free sample chapter from http://rtbook.bestpractical.com

Drew Barnes
Applications Analyst
Raymond Walters College
University of Cincinnati

No, I’m talking about manually changing the Status from New to Open.

It used to Open the ticket for us under RT 2, but when we updgraded to
3.x, it doesn’t anymore. I always thought that it must’ve been a
custom scrip under RT 2 we had opening the ticket for us.

So you are saying that when we ‘Take’ a ticket, the RT system should be
changing the status from New to Open? Can anyone think of a reason why
this would not be happening under 3.4.4?

–Andy

Drew Barnes wrote:

Hey guys,

I want to create a simple scrip that changes the status of a ticket from
New to Open when someone Takes the ticket. The Custom Condition
should be similar to the On Steal example from RT Essentials:

my $trans = $self->TransactionObj;
return 0 unless $trans->Field eq ‘Owner’;
return 1 if $trans->OldValue == RT::Nobody()->id();
return 0;

So the Custom Action should just be a one-liner that changes the ticket
status. I was hoping to find an example of what that line would look
like but couldn’t find one. Thanks for any help!

This is what we use:

Description: Open ticket on Take
Condition: User Defined
Action: User Defined
Template: Blank
Stage: TransactionCreate

Custom Condition:

if ($self->TransactionObj->Type eq 'Take' and 
    $self->TicketObj->Status eq 'new') 
{
    return(1);
} else {
    return;
}

Custom Prep:

1;

Custom Cleanup:

$self->TicketObj->SetStatus("open");
1;

Travis
Travis Campbell - Unix Systems Administrator = travis@mpdtxmail.amd.com
5900 E. Ben White Blvd, Austin, TX 78741 = travis.campbell@amd.com
TEL: (512) 602-1888 PAG: (512) 604-0341 = webmaster@mpdtxmail.amd.com
“Does anything work as expected?” Yes. An axe through the CPU.

awesome. worked great. Thanks!

–Andy

Travis Campbell wrote:> On Mon, Nov 07, 2005 at 10:40:39AM -0800, Andy Moran wrote:

Hey guys,

I want to create a simple scrip that changes the status of a ticket from
New to Open when someone Takes the ticket. The Custom Condition
should be similar to the On Steal example from RT Essentials:

my $trans = $self->TransactionObj;
return 0 unless $trans->Field eq ‘Owner’;
return 1 if $trans->OldValue == RT::Nobody()->id();
return 0;

So the Custom Action should just be a one-liner that changes the ticket
status. I was hoping to find an example of what that line would look
like but couldn’t find one. Thanks for any help!

This is what we use:

Description: Open ticket on Take
Condition: User Defined
Action: User Defined
Template: Blank
Stage: TransactionCreate

Custom Condition:

if ($self->TransactionObj->Type eq 'Take' and 
    $self->TicketObj->Status eq 'new') 
{
    return(1);
} else {
    return;
}

Custom Prep:

1;

Custom Cleanup:

$self->TicketObj->SetStatus("open");
1;

Travis