Rt-crontool and "--action RT::Action::NotifyAsComment"

Hello,

I try to use the following cron task :

/opt/rt4/bin/rt-crontool \

–search RT::Search::FromSQL
–search-arg "Created < ‘1 day ago’ AND (Status = ‘new’) "
–action RT::Action::NotifyAsComment
–action-arg ‘OtherRecipients’
–template ‘my_nice_template’

but nothing is done (no comment and no notification), because RT complains :

[critical]: Can’t call method “CreatorObj” on an undefined value at

/opt/rt4/bin/…/lib/RT/Action/Notify.pm line 134.
(/opt/rt4/bin/…/lib/RT.pm:400)

I look at “/opt/rt4/bin/…/lib/RT/Action/Notify.pm line 134” and i see :

my $creatorObj = $self->TransactionObj->CreatorObj;

So, does anybody knows :
→ how to use rt-crontool with “–action RT::Action::NotifyAsComment”,
→ or how to specify the default RT system user in the Notify.pm script
something like :

eval( my $creatorObj = $self->TransactionObj->CreatorObj) || my
$creatorObj = <RT_DEFAULT_USER_OBJ>;

Thank you for any suggestion !

Eric

Hello,
I try to use the following cron task :
/opt/rt4/bin/rt-crontool \

 --search RT::Search::FromSQL \
 --search-arg "Created < '1 day ago' AND (Status = 'new') " \
 --action RT::Action::NotifyAsComment \
 --action-arg 'OtherRecipients'
 --template 'my_nice_template'

but nothing is done (no comment and no notification), because RT complains :

 [critical]: Can't call method "CreatorObj" on an undefined value at
 /opt/rt4/bin/../lib/RT/Action/Notify.pm line 134. (/opt/rt4/bin/../lib/RT.pm:400)

I look at “/opt/rt4/bin/…/lib/RT/Action/Notify.pm line 134” and i see :

 my $creatorObj = $self->TransactionObj->CreatorObj;

So, does anybody knows :
→ how to use rt-crontool with “–action RT::Action::NotifyAsComment”,
→ or how to specify the default RT system user in the Notify.pm script
something like :

 eval( my $creatorObj = $self->TransactionObj->CreatorObj) || my $creatorObj =
 <RT_DEFAULT_USER_OBJ>;

You want the --transaction argument if you’re going to use a Notify
action:
http://bestpractical.com/docs/rt/latest/rt-crontool.html
You want first or last, not all.

You may find the notification example of the reminders documentation
interesting
http://bestpractical.com/docs/rt/latest/reminders.html#Email-Reminders

-kevin

Many thanks for tour help !Le 21 janv. 2014 20:38, “Kevin Falcone” falcone@bestpractical.com a écrit :

On Thu, Jan 16, 2014 at 06:46:06PM +0100, Eric Maisonobe wrote:

Hello,
I try to use the following cron task :
/opt/rt4/bin/rt-crontool \

 --search RT::Search::FromSQL \
 --search-arg "Created < '1 day ago' AND (Status = 'new') " \
 --action RT::Action::NotifyAsComment \
 --action-arg 'OtherRecipients'
 --template 'my_nice_template'

but nothing is done (no comment and no notification), because RT
complains :

 [critical]: Can't call method "CreatorObj" on an undefined value at
 /opt/rt4/bin/../lib/RT/Action/Notify.pm line 134.

(/opt/rt4/bin/…/lib/RT.pm:400)

I look at “/opt/rt4/bin/…/lib/RT/Action/Notify.pm line 134” and i
see :

 my $creatorObj = $self->TransactionObj->CreatorObj;

So, does anybody knows :
→ how to use rt-crontool with “–action RT::Action::NotifyAsComment”,
→ or how to specify the default RT system user in the Notify.pm
script
something like :

 eval( my $creatorObj = $self->TransactionObj->CreatorObj) || my

$creatorObj =

 <RT_DEFAULT_USER_OBJ>;

You want the --transaction argument if you’re going to use a Notify
action:
rt-crontool - RT 5.0.5 Documentation - Best Practical
You want first or last, not all.

You may find the notification example of the reminders documentation
interesting
Reminders - RT 5.0.5 Documentation - Best Practical

-kevin