Approval by group

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

Todd Chapman wrote:

I’m not sure why you would need to split it into two.

I’m not sure, either. The only thing I can tell you is that it errored
out and failed to create the approval at all until I split it in three.

It looks like you have a comma between the two statements. It should
be a semicolon.

Commas work sort of like semicolons in Perl. The difference being that
when you list multiple statements separated by commas, it only returns
the result of the last statement in the list. I did it that way to be
safe, as I wasn’t sure if the return codes from the other statements
might put bogus information in the field. If it works with semicolons,
there’s no reason to do it one way over the other. Semicolons might be
more obvious.

-Bitt

Todd Chapman wrote:

Glad we got this all sorted out.

Me too.

Thanks very much for your help. It’s hard for me to get my mind
around the innards of a new (to me) product when I don’t even understand
how the externals work yet.

Again, thanks.

-Bitt