<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<div class="">On Dec 5, 2016, at 12:21 PM, Stephen Switzer <<a href="mailto:steve@sbsroc.com" class="">steve@sbsroc.com</a>> wrote:</div>
<div>
<blockquote type="cite" class=""><br class="Apple-interchange-newline">
<div class="">
<div style="font-size: 10pt; font-family: Verdana,Geneva,sans-serif" class="">
<p class="">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":</p>
<p style="padding-left: 30px;" class="">my $groupname='Cust-Customer1';<br class="">
<br class="">
# Load the custom group from RT<br class="">
my $groupObj = RT::Group->new($RT::SystemUser); $groupObj->LoadUserDefinedGroup($groupname);<br class="">
return undef unless $groupObj;</p>
<p style="padding-left: 30px;" class="">#This worked<br class="">
#my $admincclist = $self->TicketObj->AdminCc;<br class="">
#$admincclist->AddMember($groupObj->Id);</p>
<p style="padding-left: 30px;" class="">#This doesn't work...<br class="">
$self->TicketObj->AddWatcher(<br class="">
  Type=>"Customer",<br class="">
  PrincipalId=>$groupObj->Id<br class="">
);<br class="">
return 1;</p>
<p class="">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.</p>
<p class="">Thank you!</p>
<div class=""><br class="">
</div>
</div>
</div>
</blockquote>
<br class="">
</div>
<div>
<div class="">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).</div>
<div class=""><br class="">
</div>
<div class="">Untested code:</div>
<div class=""><br class="">
</div>
<div class=""><font face="Courier New" class="">my $groupname='Cust-Customer1';<br class="">
<br class="">
# Load the custom group from RT<br class="">
my $groupObj = RT::Group->new($RT::SystemUser); </font></div>
<div class=""><span style="font-family: 'Courier New';" class="">   $groupObj->LoadUserDefinedGroup($groupname);</span></div>
<div class=""><font face="Courier New" class="">return undef unless $groupObj;<br class="">
<br class="">
#This worked<br class="">
#my $admincclist = $self->TicketObj->AdminCc;<br class="">
#$admincclist->AddMember($groupObj->Id);<br class="">
<br class="">
#This doesn't work...</font></div>
<div class=""><font face="Courier New" class=""><b class="">my ($status, $message) =
</b>$self->TicketObj->AddWatcher(<br class="">
  Type        => "Customer",<br class="">
  PrincipalId => $groupObj->Id<br class="">
);<br class="">
</font></div>
<div class=""><font face="Courier New" class=""><b class="">RT->Logger->warning("AddWatcher Status: $status");</b></font></div>
<div class=""><font face="Courier New" class=""><b class="">RT->Logger->warning("AddWatcher Message: $message");</b></font></div>
</div>
<div class=""><font face="Courier New" class="">return 1;</font></div>
<br class="">
<div class="">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">
--<br class="">
Landon Stewart<br class="">
Lead Analyst - Abuse and Security Management<br class="">
INTERNAP ®<br class="">
📧 <a href="mailto:lstewart@internap.com" class="">lstewart@internap.com</a><br class="">
🌍 <a href="http://www.internap.com" class="">www.internap.com</a></div>
</div>
</div>
<br class="">
</body>
</html>