Sorry, hit enter somehow instead of pasting. See below for full script and errors.
________________________________ From: Kimberly McKinnis Sent: Monday, April 28, 2008 3:04 PM To: 'rt-users@lists.bestpractical.com' Subject: script unintentionally cc'ing RT user I realize the topic of cc'ing users has been covered many times, but I'm struggling with a particular issue. I ganked a script off of the wiki to add cc'd users (from email) to the ticket. However, the RT user is getting added to the ticket also, and the problem this poses is... the high priority ticketing email cc's the oncall cell phones. Every time someone responds to a ticket from the high priority queue, the RT user continues to be cc'd (people don't always remember to check the box in the web UI to remove the cc), which causes people's cell phones to go mad from SMS overload. This is the script I am using: #uncomment Logger stuff for debuging $RT::Logger->debug("Running Script TestScriptAddCC"); my $Actor = $self->TransactionObj->Creator; my $Corresponder_id = $self->TransactionObj->CreatorObj->PrincipalId; my $OwnerEmail = $self->TicketObj->OwnerObj->EmailAddress(); # Kims debug statement #$RT::Logger->debug("Actor id is: $Actor"); # exit if actor is RT_SystemUser return 1 if $Actor->id == $RT::SystemUser->id; # get out if corresponder is already requestor,cc or admincc. if ( $self->TicketObj->IsWatcher( Type => 'Requestor', PrincipalId => $Corresponder_id) ){ #$RT::Logger->debug("TestScriptAddCC - Corresponder is Requestor, exit"); return 1; } if ( $self->TicketObj->IsWatcher( Type => 'Cc', PrincipalId => $Corresponder_id) ){ #$RT::Logger->debug("TestScriptAddCC - Corresponder is in CC, exit"); return 1; } if ( $self->TicketObj->IsWatcher( Type => 'AdminCc', PrincipalId => $Corresponder_id) ){ #$RT::Logger->debug("TestScriptAddCC - Corresponder is in AdminCC, 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; ~~~~~ I think actor->id is what's causing the problem, but I'm not sure where to go from here: [Mon Apr 28 22:00:28 2008] [debug]: Found 7 scrips (/usr/lib/rt/RT/Scrips_Overlay.pm:356) [Mon Apr 28 22:00:28 2008] [debug]: Running Script TestScriptAddCC ((eval 2423):2) [Mon Apr 28 22:00:28 2008] [error]: Scrip 21 Prepare failed: Can't call method "id" without a package or object reference at (eval 2423) line 13. Stack: [(eval 2423):13] [/usr/lib/rt/RT/ScripAction_Overlay.pm:233] [/usr/lib/rt/RT/Scrip_Overlay.pm:478] [/usr/lib/rt/RT/Scrips_Overlay.pm:236] [/usr/lib/rt/RT/Transaction_Overlay.pm:162] [/usr/lib/rt/RT/Record.pm:1438] [/usr/lib/rt/RT/Ticket_Overlay.pm:2404] [/usr/lib/rt/RT/Ticket_Overlay.pm:2319] [/usr/lib/rt/RT/Interface/Web.pm:510] [/var/rt/html/Ticket/Display.html:138] [/var/rt/html/Ticket/Update.html:214] [/var/rt/html/autohandler:215] (/usr/lib/rt/RT/Action/UserDefined.pm:65)
_______________________________________________ http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users Community help: http://wiki.bestpractical.com Commercial support: [EMAIL PROTECTED] Discover RT's hidden secrets with RT Essentials from O'Reilly Media. Buy a copy at http://rtbook.bestpractical.com