[rt-users] Add requestor group as cc
Kevin Falcone
falcone at bestpractical.com
Wed Sep 21 10:35:31 EDT 2011
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20110921/27d17873/attachment.sig>
More information about the rt-users
mailing list