<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p>I very much appreciate your response. This is what this gave me:</p>
<p>[27999] [Mon Dec 5 23:22:01 2016] [warning]: AddWatcher Status:
0 ((eval 471):14)<br>
[27999] [Mon Dec 5 23:22:01 2016] [warning]: AddWatcher Message:
That role is invalid for this object ((eval 471):15)<br>
</p>
<p>The custom role indeed "Applies to" the queue that the ticket was
created in, so I'm confused... scripts don't support custom roles,
maybe?<br>
</p>
<div class="moz-signature">
<p style="padding-bottom: 5px;">Best regards,<br>
Steve<br>
</p>
<br>
</div>
<div class="moz-cite-prefix">On 12/05/2016 05:24 PM, Landon Stewart
wrote:<br>
</div>
<blockquote
cite="mid:76CD05D4-83F7-4889-B1EF-C0EF9A1CC4D7@internap.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<div class="">On Dec 5, 2016, at 12:21 PM, Stephen Switzer <<a
moz-do-not-send="true" 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 class="" face="Courier New">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 class="" face="Courier New">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 class="" face="Courier New"><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 class="" face="Courier New"><b class="">RT->Logger->warning("AddWatcher
Status: $status");</b></font></div>
<div class=""><font class="" face="Courier New"><b class="">RT->Logger->warning("AddWatcher
Message: $message");</b></font></div>
</div>
<div class=""><font class="" face="Courier New">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 moz-do-not-send="true"
href="mailto:lstewart@internap.com" class="">lstewart@internap.com</a><br
class="">
🌍 <a moz-do-not-send="true" href="http://www.internap.com"
class="">www.internap.com</a></div>
</div>
</div>
<br class="">
</blockquote>
<br>
</body>
</html>