Add requestor group as cc

Dear all,

we use the scrip “AddSquelchedCC” to add groups members of the creating
user as cc. Works like harm, except for the fact, that if admin of the
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 ?

Best regards,

Michael

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

Hi Kevin,

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

Thanks for your hint, I will play around with some loops.

Best regards - Michael