[rt-users] custom template probs using RT::Group
Andy Smith
a.smith at ukgrid.net
Mon Mar 16 10:29:26 EDT 2009
Hi,
On RT 3.8.2 I am trying to use the example here:
http://wiki.bestpractical.com/view/SendEmailAction
When I try and use the section in the template as described in the wiki:
To: { my $GroupObj = RT::Group->new($user);
$GroupObj->LoadUserDefinedGroup('Group Name');
$GroupObj->MemberEmailAddressesAsString()}
it doesn't work for me, I see this error in the system messages file:
Mar 16 00:01:52 alpha RT: RT::Users=HASH(0x16b0a97c) was created
without a CurrentUser. Any RT object which is subclass of RT::Base
must be created with a RT::CurrentUser or a RT::User object as the
first argument. (/usr/local/lib/perl5/site_perl/5.8.9/RT/Base.pm:108)
Mar 16 00:01:53 alpha RT: Template parsing error:
RT::Users=HASH(0x16b0a97c) was created without a CurrentUser at
/usr/local/lib/perl5/site_perl/5.8.9/RT/SearchBuilder.pm line 81
RT::SearchBuilder::_Init('RT::Users=HASH(0x16b0a97c)', undef) called
at /usr/local/lib/perl5/site_perl/5.8.9/RT/Users_Overlay.pm line 80
RT::Users::_Init('RT::Users=HASH(0x16b0a97c)', undef) called at
/usr/local/lib/perl5/site_perl/5.8.9/DBIx/SearchBuilder.pm line 93
DBIx::SearchBuilder::new('RT::Users', undef) called at
/usr/local/lib/perl5/site_perl/5.8.9/RT/Group_Overlay.pm line 843
RT::Group::UserMembersObj('RT::Group=HASH(0x16b327ac)') called at
/usr/local/lib/perl5/site_perl/5.8.9/RT/Group_Overlay.pm line 878
RT::Group::MemberEmailAddresses('RT::Group=HASH(0x16b327ac)') called
at /usr/local/lib/perl5/site_perl/5.8.9/RT/Group_Overlay.pm line 899
RT::Group::MemberEmailAddressesAsString('RT::Group=HASH(0x16b327ac)')
called at template line 3 eval 'package Text::Template::GEN2;
; #line 1 template my $GroupObj = RT::Group->new
Mar 16 00:01:53 alpha kernel: oup->new
It does work if I use this code:
To: { my $GroupObj = RT::Group->new($RT::SystemUser);
$GroupObj->LoadUserDefinedGroup('Group Name');
$GroupObj->MemberEmailAddressesAsString()}
But I don't understand the difference, is using $RT::SystemUser going
to do anything bad? If this is ok and there is some problem with the
code as is on the wiki should I update the data on the wiki?
thanks for any help, Andy.
More information about the rt-users
mailing list