<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
Hi Chris,
<div><br>
</div>
<div>first of all thanks for improving my script.</div>
<div><br>
</div>
<div>I create my tickets vie the WebUI, but RT doesn't add the logged in user as a requestor in my RT instance. Do I have to configure this somehow, or should this be the default? As I already mentioned some mails before (at least I think so): I'm using RT
 4.0.1. Any ideas?</div>
<div><br>
</div>
<div>Regards,</div>
<div>Fabian<br>
<div><br class="Apple-interchange-newline">
<blockquote type="cite">
<div>Hi Fabian,<br>
<br>
you could simplify you script as you don't need the principal stuff <br>
here. The scrip would then look like this:<br>
<br>
my $scrip = 'Script:AutoAddCreatorAsRequestor';<br>
<br>
# Get Current Ticket<br>
my $Ticket = $self->TicketObj;<br>
# Get Current Ticket ID<br>
my $Id = $Ticket->id;<br>
# Get E-Mail-Address of creator<br>
my $EmailAddr = $self->TransactionObj->CreatorObj->EmailAddress;<br>
# Type of watch<br>
my $type = 'Requestor';<br>
<br>
# Add the creator as a watcher of type $type (requestor)<br>
my ($ret, $msg) = $Ticket->AddWatcher(Type  => $type, Email => $EmailAddr);<br>
<br>
# Check if adding was successful<br>
if ($ret) {<br>
  $RT::Logger->info("$scrip: New $type watcher added to ticket #$Id: <br>
$EmailAddr");<br>
} else {<br>
  $RT::Logger->error("$scrip: Failed to add new $type watcher to ticket <br>
#$Id: $EmailAddr - $msg");<br>
}<br>
<br>
return 1;<br>
<br>
But I don't understand why you need this scrip.<br>
How do you create your tickets? Email, WebUI, REST?<br>
<br>
If you create your ticket by email RT will automatic load the creator <br>
(From email address) as the requestor.<br>
If you create you ticket by WebUI, RT put the email address of the <br>
currently logged in user in the requestor field.<br>
<br>
-Chris<br>
<br>
Am 04.07.2011 12:02, schrieb Fabian Unfried:<br>
<blockquote type="cite">my $scrip = 'Script:AutoAddCreatorAsRequestor';<br>
</blockquote>
<blockquote type="cite"><br>
</blockquote>
<blockquote type="cite"># Get Current Ticket<br>
</blockquote>
<blockquote type="cite">my $Ticket = $self->TicketObj;<br>
</blockquote>
<blockquote type="cite"># Get Current Ticket ID<br>
</blockquote>
<blockquote type="cite">my $Id = $Ticket->id;<br>
</blockquote>
<blockquote type="cite"># Get E-Mail-Address of creator<br>
</blockquote>
<blockquote type="cite">my $EmailAddr = $self->TransactionObj->CreatorObj->EmailAddress;<br>
</blockquote>
<blockquote type="cite"># Get user object of creator<br>
</blockquote>
<blockquote type="cite">my $User = RT::User->new($RT::SystemUser);<br>
</blockquote>
<blockquote type="cite">$User->LoadByEmail($EmailAddr);<br>
</blockquote>
<blockquote type="cite"># Type of watch<br>
</blockquote>
<blockquote type="cite">my $type = 'Requestor';<br>
</blockquote>
<blockquote type="cite"># Principal of user<br>
</blockquote>
<blockquote type="cite">my $Principal = $User->PrincipalId;<br>
</blockquote>
<blockquote type="cite"><br>
</blockquote>
<blockquote type="cite"># Add the creator as a watcher of type $type (requestor)<br>
</blockquote>
<blockquote type="cite">my ($ret, $msg) = $Ticket->AddWatcher(Type  => $type, Email =><br>
</blockquote>
<blockquote type="cite">$EmailAddr, PrincipalId => $Principal,);<br>
</blockquote>
<blockquote type="cite"><br>
</blockquote>
<blockquote type="cite"># Check if adding was successful<br>
</blockquote>
<blockquote type="cite">if ($ret) {<br>
</blockquote>
<blockquote type="cite">  $RT::Logger->info("$scrip: New $type watcher added to ticket #$Id:<br>
</blockquote>
<blockquote type="cite">$EmailAddr (#$Principal)");<br>
</blockquote>
<blockquote type="cite">} else {<br>
</blockquote>
<blockquote type="cite">  $RT::Logger->error("$scrip: Failed to add new $type watcher to ticket<br>
</blockquote>
<blockquote type="cite">#$Id: $EmailAddr (#$Principal) - $msg");<br>
</blockquote>
<blockquote type="cite">}<br>
</blockquote>
<blockquote type="cite"><br>
</blockquote>
<blockquote type="cite">return 1;<br>
</blockquote>
<br>
<br>
</div>
</blockquote>
</div>
<br>
<div><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; ">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; ">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; ">
<div><br class="Apple-interchange-newline">
--</div>
<div>Fabian Unfried</div>
<div>Senior Software Engineer<br>
Zebra Enterprise Solutions</div>
<div><br>
Rossfelder Str. 65/5, 74564 Crailsheim, Germany<br>
T+49 7951 96360 F+49 7951 963611<br>
<a href="mailto:funfried@zebra.com">funfried@zebra.com</a><br>
<a href="http://www.zebra.com/zes">www.zebra.com/zes</a><br>
WhereNet * proveo * Multispectral Solutions<br>
<br>
Managing Directors Zebra Enterprise Solutions GmbH:<br>
Phil Gerskovich, Gilles Pelzer, Michael Smiley<br>
Registered Office: Ulm, HRB 721672<br>
VAT Number: DE225496806</div>
</span></div>
</span></div>
</span></span></span></div>
<br>
</div>
<br>
<hr>
<font face="Arial" color="Gray" size="1">- CONFIDENTIAL-<br>
<br>
This email and any files transmitted with it are confidential, and may also be legally privileged. If you are not the intended recipient, you may not review, use, copy, or distribute this message. If you receive this email in error, please notify the sender
 immediately by reply email and then delete this email.<br>
</font>
</body>
</html>