On Wed, Sep 21, 2011 at 10:46:33AM +0200, Michael Polenske wrote:
> system creates a ticket for the user (if user in on the phone and has no
> internet access) - in that case the groups of the admin will be added to
> cc. I guess the problem is that in the scrip "creator" is used to find
> out the membership of the groups and not "requestor":
> 
>  
> 
> my $groups = RT::Groups->new($RT::SystemUser);
> 
> $groups->LimitToUserDefinedGroups();
> 
>  
> 
> while (my $group = $groups->Next()) {
> 
>       next unless $group->Name =~ /^TEAM_/;
> 
>       if($group->HasMemberRecursively($ticket->Creator)){
> 
>               $ticket->AddWatcher(Type=>"Cc",PrincipalId=>$group->Id);
> 
>  
> 
>  
> 
> So best solution for me would be to exchange
> 
> "HasMemberRecursively($ticket->Creator"
> 
> With
> 
> "HasMemberRecursively($ticket->Requestor"
> 
> But this does not work. Any hint ?

There is no Requestor method on a Ticket

There can also be multiple Requestors but only one Creator.

I suggest you start by looking at the docs in Group for
HasMemberRecursively, which will tell you that it expects a Principal.
Then you'll need to change the code to either get the first
requestor's Principal object or loop and handle multiple Requestors
passing each one's Principal object down into HasMemberRecursively

-kevin

Attachment: pgpbeg4aG7ha1.pgp
Description: PGP signature

--------
RT Training Sessions (http://bestpractical.com/services/training.html)
*  Chicago, IL, USA — September 26 & 27, 2011
*  San Francisco, CA, USA — October 18 & 19, 2011
*  Washington DC, USA — October 31 & November 1, 2011
*  Melbourne VIC, Australia — November 28 & 29, 2011
*  Barcelona, Spain — November 28 & 29, 2011

Reply via email to