[rt-users] adding bcc

slamp slamp slackamp at gmail.com
Thu Oct 18 10:42:02 EDT 2007


hi, i am using the following custom action preparation code i found on
the wiki. how do i do the same exact thing except for a bcc? and then
how do i create an action to notify bcc?

#uncomment Logger stuff for debuging
$RT::Logger->debug('Running Script ScriptAddCC');

my $Actor = $self->TransactionObj->Creator;
my $Corresponder_id = $self->TransactionObj->CreatorObj->PrincipalId;
my $OwnerEmail = $self->TicketObj->OwnerObj->EmailAddress();

# exit if actor is RT_SystemUser
return 1 if $Actor == $RT::SystemUser->id;

# get out if corresponder is already owner, requestor, cc or admincc.

if ( $self->TicketObj->IsWatcher( Type => 'Requestor', PrincipalId =>
$Corresponder_id)  ){
     $RT::Logger->debug("ScriptAddCC - Corresponder is Requestor, exit");
     return 1;
}

if ( $self->TicketObj->IsWatcher( Type => 'Cc', PrincipalId =>
$Corresponder_id)  ){
     $RT::Logger->debug("ScriptAddCC - Corresponder is in CC, exit");
     return 1;
}

if ( $self->TicketObj->IsWatcher( Type => 'AdminCc', PrincipalId =>
$Corresponder_id)  ){
     $RT::Logger->debug("ScriptAddCC - Corresponder is in AdminCC, exit");
     return 1;
}

if ( $self->TicketObj->IsWatcher( Type => 'Owner', PrincipalId =>
$Corresponder_id)  ){
     $RT::Logger->debug("ScriptAddCC - Corresponder is the ticket Owner, exit");
     return 1;
}

#RuslanZakirov's check
my ($status, $msg) = $self->TicketObj->AddWatcher(
     Type => "Cc",
     PrincipalId => $Corresponder_id
);

unless ( $status ) {
     $RT::Logger->error("Couldn't add watcher: $msg");
}

return 1;



More information about the rt-users mailing list