[rt-users] Help request: Custom scrip action

Tim Wilson tim_wilson at hopkins.k12.mn.us
Mon Feb 21 12:31:35 EST 2005


Hi everyone,

My organization is planning to use RT to track equipment orders. Once the
equipment is received at the central office, it's distributed out to a bunch
of other site. We've created a queue for this purpose called "Tech-orders".

I'm using the excellent ExtractCustomFieldValues.pm package to populate a
custom field with the abbreviated names of the buildings where the equipment
will eventually be delivered. That works fine. Now I'm adding another custom
Action that is supposed to scan through the contents of that custom field
and add certain users as Ccs for the ticket. (Each building has a different
person(s) in charge of deploying the equipment once it's installed.) This is
to notify those persons to be on the lookout for the equipment.

I'm a perl newbie, but this is the code I've come up with. I've included the
relevant portion of the RT log that shows the scrip failing. I would
appreciate any and all suggestions very much.

-Tim

My code:

package RT::Action::AddCcFromBuildingList;
require RT::Action::Generic;

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

sub Describe  {
  my $self = shift;
  return (ref $self );
}

sub Prepare {
  return (1);
}

sub Commit {
  my %building_watchers = (
    "ESC" => ["user1\@example.com",
              "user2\@example.com"],
    "HHS" => ["user3\@example.com"]
  );
  my $cclist = $self->TicketObj->Cc;
  my $CustomFields = $Ticket->QueueObj->CustomFields();
  my $BuildingList = $Ticket->FirstCustomFieldValue('Building List');
  
  while (my $Building = $BuildingList->Next) {
    foreach $email (@{building_watchers{$Building}}) {
      my $user = RT::User->new($RT::SystemUser);
      $user->LoadByEmail($email);
      $cclist->AddMember($user->Id);
    }
  }
  return(1);
}

1;

Logging output:

[Mon Feb 21 16:39:37 2005] [error]: Scrip Prepare 28 died. - Require of
RT::Action::AddCcFromBuildingList failed.
Global symbol "$self" requires explicit package name at
/usr/share/request-tracker3.2/lib/RT/Action/AddCcFromBuildingList.pm line
23.
Global symbol "$Ticket" requires explicit package name at
/usr/share/request-tracker3.2/lib/RT/Action/AddCcFromBuildingList.pm line
24.
Global symbol "$Ticket" requires explicit package name at
/usr/share/request-tracker3.2/lib/RT/Action/AddCcFromBuildingList.pm line
25.
Global symbol "$email" requires explicit package name at
/usr/share/request-tracker3.2/lib/RT/Action/AddCcFromBuildingList.pm line
28.
Global symbol "$email" requires explicit package name at
/usr/share/request-tracker3.2/lib/RT/Action/AddCcFromBuildingList.pm line
30.
Compilation failed in require at (eval 318) line 3.

-- 
Timothy Wilson
Technology Integration Specialist
Hopkins ISD #270, Hopkins, MN, USA  (44š56.013'N  93š24.736'W)
ph: 952.988.4103  fax: 952.988.4311  AIM: tis270





More information about the rt-users mailing list