[rt-users] Custom Condition for "Is A Member Of A Group"

Barry L. Kline blkline at attglobal.net
Thu Oct 20 23:12:54 EDT 2005

I'm trying to create a custom condition that will execute a scrip when a 
new ticket is created, but only if the submitter is not a part of a 
group.  Specifically, we want to be notified if someone who is not a 
member of our group creates a new ticket.  We typically create tickets 
via the web interface, so we're signed in when the ticket it created. 
It'd be nice if this would work using rt-mailgate, too.

I created the following custom condition (based on one of the 
contributed wiki scrips), but the scrip fails to fire whether the ticket 
is created by a group member or not.  Any suggestions would be greatly 

My custom condition is:

if ($self->TransactionObj->Type eq 'Create') {
my $GroupObj = RT::Group->new( $session{ 'CurrentUser' } );
my $PrincipalObj = RT::Principal->new( $session{ 'CurrentUser' } );
$PrincipalObj->Load( $session{ 'CurrentUser' }->id );
$GroupObj->LoadUserDefinedGroup( 'IT_dept' );
my $HasMember = $GroupObj->HasMemberRecursively( $PrincipalObj );
return 0 if $HasMember;
return 1;
} else {
return 0;

More information about the rt-users mailing list