<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>This is a shot in the dark and I may be way off, but is there a chance your scrip to set the owner runs in a transaction that happens after the transaction that resolves the ticket?</div><div><br></div><div>And the chart looks for the resolved transaction to get owner at the time of resolution?</div><div><br></div><div>Just a thought. <br><br><div>Sent from my mobile device. </div></div><div><br>On Oct 4, 2012, at 7:05 AM, Scotto Alberto <<a href="mailto:al.scotto@reply.it">al.scotto@reply.it</a>> wrote:<br><br></div><blockquote type="cite"><div>

<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style>
<!--
@font-face
        {font-family:Wingdings}
@font-face
        {font-family:Wingdings}
@font-face
        {font-family:Calibri}
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif"}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {margin-top:0cm;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:36.0pt;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif"}
span.EmailStyle17
        {font-family:"Calibri","sans-serif";
        color:windowtext}
.MsoChpDefault
        {}
@page WordSection1
        {margin:70.85pt 2.0cm 2.0cm 2.0cm}
div.WordSection1
        {}
ol
        {margin-bottom:0cm}
ul
        {margin-bottom:0cm}
-->
</style>


<div class="WordSection1">
<p class="MsoNormal">Hi all,</p>
<p class="MsoNormal"><span lang="EN-US">I think I found a bug.</span></p>
<p class="MsoNormal"><span lang="EN-US">I have a scrip called "On closure Auto set owner", which sets the owner while closing the ticket in case nobody has never taken it, so that I don't get resolved tickets assigned to "Nobody in particular".</span></p>
<p class="MsoNormal"><span lang="EN-US">Everything seemed ok until today a colleague of mine noticed something weird with a chart that acts like a hall of fame, showing the top Owners. This chart is very simple: it retrieves all the tickets and it is grouped
 by Owner.RealName.</span></p>
<p class="MsoNormal"><span lang="EN-US">The weird thing is not the chart itself, but the fact that the following two queries should return the same tickets but they don’t:</span></p>
<p class="MsoListParagraph" style="text-indent:-18.0pt"><span lang="EN-US"><span style="">-<span style="font:7.0pt "Times New Roman"">         
</span></span></span><span lang="EN-US">Owner.RealName = 'Nobody in particular' returns 706 tickets</span></p>
<p class="MsoListParagraph" style="text-indent:-18.0pt"><span lang="EN-US"><span style="">-<span style="font:7.0pt "Times New Roman"">         
</span></span></span><span lang="EN-US">Owner = 'Nobody in particular' returns 369 tickets</span></p>
<p class="MsoNormal"><span lang="EN-US">The results of the former are not correct: it includes also the tickets for which the owner was set by my scrip, though the column “Owner” is correct (filled with “John Doe”, not “Nobody in particular”).</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">Here are the relevant lines of the code of my scrip:</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US"># get actor ID</span></p>
<p class="MsoNormal"><span lang="EN-US">my $Actor = $self->TransactionObj->Creator;</span></p>
<p class="MsoNormal"><span lang="EN-US">my $tkt = $self->TicketObj;</span></p>
<p class="MsoNormal"><span style="font-family:"Arial","sans-serif"; color:black"># try to change owner</span><span lang="EN-US"></span></p>
<p class="MsoNormal"><span lang="EN-US">my ($status, $msg) = $tkt->_Set(Field => 'Owner', Value => $Actor, RecordTransaction => 0);</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">I solved the problem using SetOwner instead of _Set, like this:</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">my ($status, $msg) = $tkt->SetOwner($Actor);</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">With the new code, the tickets whose owner is set by my scrip don’t get caught by the query Owner.RealName = 'Nobody in particular'.</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">Looks like _Set doesn’t update correctly some field in some table in the DB. But I have no idea of what field and what table! I had a quick look at the DB, and it seems that the relation ticket-owner is based on an user
 ID, not a string (the real name).</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">Finally, a weird thing with the chart: on the right side, it displays all the owners and the number of tickets associated. For “Nobody in particular”, the number is 369 (correct); but if I click on this number it generates
 the query “Owner.RealName = 'Nobody in particular'” saying “Found 706 tickets”.</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">The questions are:</span></p>
<p class="MsoNormal"><span lang="EN-US">Should I file a bug?</span></p>
<p class="MsoNormal"><span lang="EN-US">How can I “convert” the tickets that were processed with the old code?</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">Hope everything is clear</span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US">Thank you very much!</span></p>
</div>
<br>
<br>
<div align="left">
<p style="font-family:Calibri,Sans-Serif; font-size:10pt"><span style="color:#000000">Alberto Scotto</span>
<span style="color:#808080"></span><br>
<br>
<span style="color:#808080; font-weight:bold">Blue Reply</span> <br>
<span style="color:#808080">Via Cardinal Massaia, 83<br>
10147 - Torino - ITALY <br>
phone: +39 011 29100 <br>
<a href="al.scotto@reply.it" target="" style="color:blue; text-decoration:underline">al.scotto@reply.it</a>
<br>
<a title="" href="www.reply.it" target="" style="color:blue; text-decoration:underline">www.reply.it</a>
</span><br>
<br>
<span style="color:#000000"><blue.png>
</span><br>
 </p>
</div>
<br>
<hr>
<font face="Arial" color="Gray" size="1"><br>
--<br>
The information transmitted is intended for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information
 by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.<br>
</font>


</div></blockquote><blockquote type="cite"><div><span></span><br><span>--------</span><br><span>Final RT training for 2012 in Atlanta, GA - October 23 & 24</span><br><span>  <a href="http://bestpractical.com/training">http://bestpractical.com/training</a></span><br><span></span><br><span>We're hiring! <a href="http://bestpractical.com/jobs">http://bestpractical.com/jobs</a></span><br></div></blockquote></body></html>