My User-Defined scrips (examples)

I didn’t see this covered in the documentation or when I googled over
rt-users, so I thought I’d share this for any one’s benefit.

I wasn’t pleased with RT3’s global scrip, “On Correspond Notify AdminCCs
with Template Admin Correpondence” because it made for too much traffic.
So I deleted that and added, “On Correspond Notify Owner with template
Correspondence” through the web interface. I also needed something like,
“On Correspond to Unowned Notify Admin Ccs W Admin Correspondence”. So…

On the Add a scrip page, I used
- Condition: User-defined
- Custom Condition:

if (($self->TransactionObj->Type eq "Correspond") and
    ($self->TicketObj->OwnerObj->Id == $RT::Nobody->Id)) {
      return(1);
} else {
      return(undef);
}

- Action: NotifyAdminCCs
- Template: Global Template: Admin Correspondence

I also implemented AutoTake as user-defined scrip instead of using the
contribute code:
- Condition: On Correspond
- Action: User Defined
- Custom action preparation code:

my $retval = undef;
if ( defined( $self->TicketObj->OwnerObj->id ) ){
    if( $self->TicketObj->OwnerObj->Id == $RT::Nobody->Id ){
	$retval = 1;
    }
}

- Custom action cleanup code: 
my $retval = undef;
if ($self->TransactionObj->CreatorObj->Privileged &&
    $self->TransactionObj->CreatorObj->Id != $RT::Nobody->Id ) {
    if( $self->TransactionObj->CreatorObj->HasRight( Object =>
	$self->TicketObj->QueueObj, Right => 'OwnTicket')) {
	$RT::Logger->info("Autotake ticket");
            # They can own the ticket.  Make it so.
	$retval = $self->TicketObj->SetOwner(
	$self->TransactionObj->CreatorObj->Id );
    }
}
return( $retval );

- Template: Global Template: Taken [local template]

Hope someone finds this useful.

Cheers,

Peter

Peter Burkholder, System Administrator
Digital Library for Earth System Education (DLESE – http://www.dlese.org)
peterb@ucar.edu
DLESE Program Center (DPC) ~~~ ~~ ~~~~ __o
UCAR/DPC, P.O. Box 3000 Ph) 303-497-2663 ~~~ ~~~~ ~~ `<,
Boulder, CO 80307-3000 Fx) 303-497-8336 ~~~~ ~~~ ~~~~ ()/ ()

There aren’t any diffs to send. All these scrips were done via the RT3
interface. Sign in as root and follow:

Configuration->Global->Scrips->New Scrip

P.

  • Peter Burkholder <peterb_at_ucar_dot_edu> [20030429 01:05]: wrote:

I didn’t see this covered in the documentation or when I googled over
rt-users, so I thought I’d share this for any one’s benefit.

I wasn’t pleased with RT3’s global scrip, “On Correspond Notify AdminCCs
with Template Admin Correpondence” because it made for too much traffic.
So I deleted that and added, “On Correspond Notify Owner with template
Correspondence” through the web interface. I also needed something like,
“On Correspond to Unowned Notify Admin Ccs W Admin Correspondence”. So…
[snip]

Hope someone finds this useful.

Hello Peter,

Thank you for the contributions. I am in the process of testing RT3 and I
believe your scrips will help. Could you please drop me the diff-ed files?

Thanks in advance.

-Wash


Odhiambo Washington wash@wananchi.com “The box said ‘Requires
Wananchi Online Ltd. www.wananchi.com Windows 95, NT, or better,’
Tel: +254 2 313985-9 +254 2 313922 so I installed FreeBSD.”
GSM: +254 72 743223 +254 733 744121 This sig is McQ! :slight_smile:

Anybody who doesn’t cut his speed at the sight of a police car is
probably parked.
Peter Burkholder, System Administrator
Digital Library for Earth System Education (DLESE – http://www.dlese.org)
DLESE Program Center (DPC) ~~~ ~~ ~~~~ __o
UCAR/DPC, P.O. Box 3000 Ph) 303-497-2663 ~~~ ~~~~ ~~ `<,
Boulder, CO 80307-3000 Fx) 303-497-8336 ~~~~ ~~~ ~~~~ ()/ ()