Scrips help: adding admincc based on requestor's information

Hi All,

I’m new at creating scrips for RT. I need to create a scrips to add an
additional admin to the existing admincc list if the requestor belongs
to a certain organization when the ticket is being created. I’m not
sure how to check the requestor’s Organization information field.

I have the following so far:

Condition: On Create
Action: User Defined
Template: Global template: blank
Stage: TransactionCreate

Custom action preparation code:
return 1;

Custom action cleanup code:
my $admincclist = $self->TicketObj->AdminCC;
if($self->TicketObj->Requestors->Organization eq “UK”) {
my $admin = RT::User->new($RT::SystemUser);
$admin->LoadByEmail(‘blablah@somewhere.com’);
$admincclist->AddMember($user->Id);
return 1;
}
else {
return undef
}

However, it seems like it does not seems to detect the field correctly.
It’s my first attempt at scrips so any help would be greatly
appreciated.

Thanks

CONFIDENTIALITY NOTICE: The information contained in this message and
or attachments is intended only for the person or entity to which it is
addressed and may contain confidential and/or privileged material. Any
review, retransmission, dissemination, copying, or other use of this
information by persons or entities other than the intended recipient is
prohibited. If you received this e-mail or its attachments in error,
please contact the sender and delete the material from any system and
destroy any copies.

Hi All,

I’m new at creating scrips for RT. I need to create a scrips to add an
additional admin to the existing admincc list if the requestor belongs
to a certain organization when the ticket is being created. I’m not
sure how to check the requestor’s Organization information field.

Here’s how I do it. Note that I use a custom field called Domain for
the comparison. Should get you going in the right direction though.

Descript: AddWatcherCompanyX
Condition: User Defined
Custom Condition:

return undef unless ($self->TransactionObj->Type eq “Create”);
return undef unless ($self->TicketObj->FirstCustomFieldValue(‘Domain’) =~
/CompanyX/i);
return 1;

Action: User Defined
Action Prep:
my ($status, $msg) = $self->TicketObj->AddWatcher(Type => ‘Cc’, Email
=> "user@companyx.example.com" );
return 1;

Action cleanup:
return 1;

Stage: TransactionCreate
Global Template Blank
Andy Harrison