[rt-users] Help, I've forgotten all my perl knowledge

Marc A. Runkel marc at tiosky.net
Wed Jun 15 19:38:57 EDT 2005


I'm trying to write a scrip that will add a user as a 2nd requestor to
any email that comes in from a particular domain.

So I have:

Condition: On Create
Action: User Defined
Template: Global Blank
Stage: TransactionCreate

In preparation code I have:

my $requestor_address = $self->TicketObj->RequestorAddresses;
my $domain = "domain.com";
# If the user is from domain.com but NOT the manager, do the magic.
if ( $requestor_address =~ /$domain/i && $requestor_address !~
/'manager at domain.com'/i )
{
    return 1;
}
else {
    return 0;
}

In action cleanup code I have:

my $Reqlist = $self->TicketObj->Requestor;

my $user = RT::User->new($RT::SystemUser);
$user->LoadByEmail('manager at domain.com');

$Reqlist->AddMember($user->Id);


But it doesn't work.  What I am missing?  What am I doing wrong?   If
this works, will it also send an e-mail to the manager?

Basically, any request from this email domain, I want the manager to be
able to view, control, add, and stay in the loop.  Is there an easier
way to do this for a non-priviledge user?

M.



More information about the rt-users mailing list