Accessing AdminCC and CC names in a template


#1

Hello everyone!

I just started playing with RT templates and my perl is a bit rusty, so please bare with me, thanks!

I am trying to figure out how to get a list of the groups and users NAMES assigned to a ticket for a template.

I see that $Ticket->AdminCcAddresses will return the expanded list of all the email address for AdminCC and $Ticket->CcAddresses does the same for CC addresses.

But I am looking for the group and user “short names” that are assigned to the ticket.

I believe that $Ticket->AdminCc “Returns an RT::Group object which contains this ticket’s AdminCcs”, but I cant figure out how to expand it into strings.

Example. If I have these groups and users assigned to a ticket:
AdminCC: systems, db, storage, user1
Cc: user2, user3

I would like to be able to end up with a list of the names “systems, db, storage, user1” for AdminCC and “user2, user3” for the CC users.

Thanks for all your help!


#2

I was able to get the user and group short names with the following code:

my $group = $Ticket->AdminCc;
my $members = $group->MembersObj;
while(my $member = $members->Next)
{
my $principal = $member->MemberObj;
print "AdminCC or CC User or Group name: " . $principal->Object->Name . “\n”;
}