[rt-users] RTIR: Best way for customers to see all tickets for their employees

Landon Stewart lstewart at internap.com
Mon Dec 5 17:24:10 EST 2016


On Dec 5, 2016, at 12:21 PM, Stephen Switzer <steve at sbsroc.com<mailto:steve at sbsroc.com>> wrote:


Please excuse the re-post, but I've made some progress today, and I think I just need a tweak. I have the following code in "Custom action preparation code":

my $groupname='Cust-Customer1';

# Load the custom group from RT
my $groupObj = RT::Group->new($RT::SystemUser); $groupObj->LoadUserDefinedGroup($groupname);
return undef unless $groupObj;

#This worked
#my $admincclist = $self->TicketObj->AdminCc;
#$admincclist->AddMember($groupObj->Id);

#This doesn't work...
$self->TicketObj->AddWatcher(
  Type=>"Customer",
  PrincipalId=>$groupObj->Id
);
return 1;

Can anyone shed light on how to add a custom role member to a ticket on create? If I uncomment the admincclist lines, I get it added to the AdminCC field... but not the Customer custom role. I see no errors in the rt.log file, which is set to warning.

Thank you!


I'm not sure exactly why it's not working but you could check out the return value from $self->TicketObj->AddWatcher() and see if there's any useful information in there since AddWatcher() returns a tuple of (status, message).

Untested code:

my $groupname='Cust-Customer1';

# Load the custom group from RT
my $groupObj = RT::Group->new($RT::SystemUser);
   $groupObj->LoadUserDefinedGroup($groupname);
return undef unless $groupObj;

#This worked
#my $admincclist = $self->TicketObj->AdminCc;
#$admincclist->AddMember($groupObj->Id);

#This doesn't work...
my ($status, $message) = $self->TicketObj->AddWatcher(
  Type        => "Customer",
  PrincipalId => $groupObj->Id
);
RT->Logger->warning("AddWatcher Status: $status");
RT->Logger->warning("AddWatcher Message: $message");
return 1;

--
Landon Stewart
Lead Analyst - Abuse and Security Management
INTERNAP ®
📧 lstewart at internap.com<mailto:lstewart at internap.com>
🌍 www.internap.com<http://www.internap.com>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20161205/fd7e81de/attachment.htm>


More information about the rt-users mailing list