Unable to use NotifyGroup with rt-crontool

Folks,

I am unable to use the rt-crontool with NotifyGroup action

This is what I am running

/opt/rt4/bin/rt-crontool --search RT::Search::ActiveTicketsInQueue
–search-arg QueueName --condition RT::Condition::Overdue --action
RT::Action::NotifyGroup --action-arg GroupName

And this is the error I get

[Fri Aug 3 09:03:43 2012] [critical]: Can’t call method “CreatorObj” on an
undefined value at /opt/rt4/bin/…/lib/RT/Action/NotifyGroup.pm line 87.
(/opt/rt4/bin/…/lib/RT.pm:341)

This is the function that is failing

sub SetRecipients {
my $self = shift;

my $arg = $self->Argument;
foreach( $self->__SplitArg( $arg ) ) {
    $self->_HandleArgument( $_ );
}

my $creatorObj = $self->TransactionObj->CreatorObj;
my $creator = $creatorObj->EmailAddress();

my $TransactionCurrentUser = RT::CurrentUser->new;
$TransactionCurrentUser->LoadByName($creatorObj->Name);

unless (RT->Config->Get('NotifyActor',$TransactionCurrentUser)) {
    @{ $self->{'To'} } = grep ( !/^\Q$creator\E$/, @{ $self->{'To'} } );
}

$self->{'seen_ueas'} = {};

return 1;

}

And the line that is failing is my $creatorObj =
$self->TransactionObj->CreatorObj;

I checked to see that the group is getting loaded correctly. But it is not
able to get hold of a transactionObk it seems like.

That makes sense since there is no transaction that has occured. Rather
this is a cronjob which is triggering the action.

i also had same issue some time ago and solved it like this:

$CRONTOOL --search RT::Search::ActiveTicketsInQueue --search-arg $QUEUE
–condition RT::Condition::UnownedTicket --condition-arg $PERIOD --action
RT::Action::Notify --action-arg $EMAIL --transaction first --template
$TEMPLATE

Notify and notifyGroup seems to work similar. i had an alias on mail server
for specific group, so it was acceptable for me to send one message to this
alias.

but key thing is to use --transaction [first | last | all] to show what
transaction you want to process.On Fri, Aug 3, 2012 at 11:23 AM, Shrivallabh Deshmukh < shrivallabh.deshmukh@sungard.com> wrote:

Folks,

I am unable to use the rt-crontool with NotifyGroup action

This is what I am running

/opt/rt4/bin/rt-crontool --search RT::Search::ActiveTicketsInQueue
–search-arg QueueName --condition RT::Condition::Overdue --action
RT::Action::NotifyGroup --action-arg GroupName

And this is the error I get

[Fri Aug 3 09:03:43 2012] [critical]: Can’t call method “CreatorObj” on
an undefined value at /opt/rt4/bin/…/lib/RT/Action/NotifyGroup.pm line 87.
(/opt/rt4/bin/…/lib/RT.pm:341)

This is the function that is failing

sub SetRecipients {
my $self = shift;

my $arg = $self->Argument;
foreach( $self->__SplitArg( $arg ) ) {
    $self->_HandleArgument( $_ );
}

my $creatorObj = $self->TransactionObj->CreatorObj;
my $creator = $creatorObj->EmailAddress();

my $TransactionCurrentUser = RT::CurrentUser->new;
$TransactionCurrentUser->LoadByName($creatorObj->Name);

unless (RT->Config->Get('NotifyActor',$TransactionCurrentUser)) {
    @{ $self->{'To'} } = grep ( !/^\Q$creator\E$/, @{ $self->{'To'} }

);
}

$self->{'seen_ueas'} = {};

return 1;

}

And the line that is failing is my $creatorObj =
$self->TransactionObj->CreatorObj;

I checked to see that the group is getting loaded correctly. But it is not
able to get hold of a transactionObk it seems like.

That makes sense since there is no transaction that has occured. Rather
this is a cronjob which is triggering the action.

Jack Zabolotnyi
Arces Network, LLC

e: jzabolotnyi@arces.net
w: http://www.arces.net

PGP key: 2048R/7F2AB658 2012-07-02
PGP fingerprint: 4C7E 00A8 5210 F3D9 0509 C70E 87C8 666E 7F2A B658

I checked to see that the group is getting loaded correctly. But it is
not able to get hold of a transactionObk it seems like.

That makes sense since there is no transaction that has occured. Rather
this is a cronjob which is triggering the action.

Some actions and conditions require a transaction. See perldoc bin/rt-crontool for how to specify one.