[rt-users] Approval by group

Todd Chapman todd at chaka.net
Mon Mar 14 10:58:53 EST 2005


On Mon, Mar 14, 2005 at 10:07:27AM -0500, William Faulk wrote:
> 
> >So this is what I would try in your template:
> >
> >AdminCc: {RT::Group->new($RT::SystemUser)->Load("Unix")->PrincipalId()}
> 
> This fails to create the approval at all.  Looking in the syslog, it's 
> listing the errors:
> 
> >RT: Group -> Load called with a bogus argument 
> >(/usr/local/rt3/lib/RT/Group_Overlay.pm:265)
> >RT: Ticket creation failed: Can't call method "PrincipalId" on an 
> >undefined value at template line 5.
> 
> Unix is definitely the name of the group.  Maybe that's not the right 
> argument?  Yeah.  Group->Load() takes an ID, which is what we're trying 
> to get.  Some trial and error reveals that this works, though:
> 
> >AdminCC: {$g = RT::Group->new($RT::SystemUser), 
> >$g->LoadUserDefinedGroup("Unix"), $g->id}
> 

Ah. The reason one long statement doesn't work is that Load doesn't
return the group object. It returns a result code and a message, so
you  can't invoke a group method from the result. Duh.

Glad we got this all sorted out.

-Todd



More information about the rt-users mailing list