On 08/10/2009 17:24, Kevin Falcone wrote:
> Try using $trans->Creator or $trans->CreatorObj
> Scrips run in a system context, but the creator of the transaction
> will be the user who triggered it.
>   
Thanks! That did the trick...

So for the sake of anyone else searching later, here is the final scrip.
There's already another scrip that sets the status back to open on
correspondence.

# get actor ID
my $trans = $self->TransactionObj;
my $Ticket = $trans->TicketObj;
my $Actor = $trans->CreatorObj();

# if actor is RT_SystemUser then get out of here
return 1 if $Actor == $RT::SystemUser->id;

# All staff users are in 'RTUsers'.
my $GroupObj = RT::Group->new($Actor);
$GroupObj->LoadUserDefinedGroup( 'RTUsers' );

my $PrincipalObj = RT::Principal->new($Actor);
$PrincipalObj->Load($Actor->id);

if ($GroupObj->HasMemberRecursively($PrincipalObj)) {
      if($Ticket->Status() eq 'open')
   {
     $self->TicketObj->SetStatus('stalled');
  }

}

return 1;
_______________________________________________
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

Reply via email to