First off, my apologizes for posting to the dev list earlier in error... a true 
newbie 
 I need some guidance..


I have tried numerous versions of scrips , approaches and examples that I have 
found thanks to this list, 
but I just can't get things to work as I expect/want.
The below scrip ( found on the list...thank you ) , does work , but it requires 
that I have the hardcoded "Group_Here_Works" entry.
Usin different group names does produce those members as CC's.

What I really want to have happen is;
  the requestor's group/s members be automatically figured out and  those 
members be added as CC's to the ticket on creation.

 but I can't seem to grasp how. 

I am struggling to get my head around all this, so any assistance is very 
welcomed.

==============================
my $ticket = $self->TicketObj;
my $transaction = $self->TransactionObj;

my $derivedGroupName = 'GROUPNAME_HERE_WORKS';

# instantiate a group object
my $addGroupObj = RT::Group->new($RT::SystemUser);
$addGroupObj->LoadUserDefinedGroup($derivedGroupName);
return undef unless $addGroupObj;
my $addGroupMembersObj = $addGroupObj->UserMembersObj;

my $userObj;
# walk through members of group to add; if a given member is not already on the 
ticket, add to the CC list
while ($userObj = $addGroupMembersObj->Next) {
    if (($ticket->IsRequestor($userObj->PrincipalId)) or 
($ticket->IsCc($userObj->PrincipalId))) {
        $RT::Logger->debug("On Create Add Group CC: '" . $userObj->Name . "' is 
already a ticket watcher; not adding Cc on ticket \#" . $ticket->id );
    } else {
        $RT::Logger->debug("On Create Add Group CC: Adding '" . $userObj->Name 
."' to ticket \#" .$ticket->id);
        my ($success, $msg)= $ticket->AddWatcher( 
                                                  Type => "Cc", 
                                                  PrincipalId => $userObj->Id);
        if (! $success) {
            $RT::Logger->info("On Create Add Group CC: couldn't add '" . 
$userObj->Name . "' to " . $ticket->id . "': got '" . $msg ."'");
        }
    }
}
return 1;


_______________________________________________
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

SAVE THOUSANDS OF DOLLARS ON RT SUPPORT:

If you sign up for a new RT support contract before December 31, we'll take
up to 20 percent off the price. This sale won't last long, so get in touch 
today.
    Email us at [EMAIL PROTECTED] or call us at +1 617 812 0745.


Community help: http://wiki.bestpractical.com
Commercial support: [EMAIL PROTECTED]


Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Reply via email to