<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p
{mso-style-priority:99;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
font-size:12.0pt;
font-family:"Times New Roman",serif;}
span.EmailStyle18
{mso-style-type:personal-reply;
font-family:"Tahoma",sans-serif;
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;
font-family:"Tahoma",sans-serif;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'>Hi Alex<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'>That line copied exactly from the script.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'>The whole idea of my script is searching for specific ticket based on customefiled and refer a newly created ticket to the first ticket which has the same customfiled value. <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'>First it fills some customfields based on body of the first transaction and tries then find the first ticket which is similar to that ticket (i.e. has the same value in one of its customfield) and creates a “Refer To” link to that ticket.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'>Concept is very similar to <a href="http://requesttracker.wikia.com/wiki/AddRefersToOnEqualCustomField">http://requesttracker.wikia.com/wiki/AddRefersToOnEqualCustomField</a> but instead of putting the code as a “Scrips” I run it as a standalone perl script.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'>I have put my code and some of the errors below<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'>The only thing which might be relevant to this case is, I have one scrips with user defined condition. <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'>The condition code is in the below table:<o:p></o:p></span></p><table class=MsoTableGrid border=1 cellspacing=0 cellpadding=0 style='border-collapse:collapse;border:none'><tr><td width=623 valign=top style='width:467.5pt;border:solid windowtext 1.0pt;padding:0in 5.4pt 0in 5.4pt'><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'>return 0 unless $self->TransactionObj->Type eq "Create";<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'>my $ChatArchiverTo='xxxxx\@yyyyy.com';<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'>my $scrip='scripname';<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'>my $TO="";<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'>if (defined($self->TransactionObj->Attachments->First->GetHeader("To"))){<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> $TO = $self->TransactionObj->Attachments->First->GetHeader("To");<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'>}<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'>if($self->TicketObj->Subject =~ m/New App Request/){<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> return 0;<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'>}<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'>if (($TO =~ /$ChatArchiverTo/i)){<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> $RT::Logger->debug( "$scrip: $TO found in to");<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> return 0;<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'>}<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'>else{<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> $RT::Logger->debug( "$scrip: $TO was not found in to");<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> return 1;<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'>}<o:p></o:p></span></p></td></tr></table><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'>my $tickets = new RT::Tickets($RT::SystemUser); # Used to store Ticket search results<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'>$tickets->LimitQueue(VALUE =>'Appforall');<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'>$tickets->LimitSubject(VALUE=>'New App Request', OPERATOR=>'=');<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'>$tickets->LimitId(VALUE=>3234491,OPERATOR=>'>');<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'>$tickets->OrderByCols({FIELD=>'Id', ORDER =>'ASC'});<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'>$tickets->LimitCustomField(CUSTOMFIELD => $afa_req_type,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> OPERATOR => "!=",<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> VALUE => $afa_req_type_type);<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'>while (my $Ticket = $tickets->Next) {<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> my $customer_id="";<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> my $app_name="";<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> my $txns = $Ticket->Transactions;<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> while (my $txn = $txns->Next ) {<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> if ($txn->Type ne 'Create'){<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> next;<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> }<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> my $attachments = RT::Attachments->new($txn->CurrentUser);<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> $attachments->Limit( FIELD => 'TransactionID', VALUE => $txn->id );<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> $attachments->ContentType (VALUE => 'text/plain');<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> $attachments->OrderBy( FIELD => 'Id', ORDER => 'ASC' );<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> while ( my $a = $attachments->Next ) {<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> if($a->Content =~ /customer_id = (\d+).*app_name = ([^\n]+)/s){<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> $customer_id=$1;<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> $app_name=$2;<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> last;<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> }<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> }<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> }<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> if ($customer_id eq '' or $app_name eq ''){<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> print "ERROR: customer_id or app_name for ticket $Ticket->Id did not find\n";<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> next;<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> }<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> my $ptickets = new RT::Tickets($RT::SystemUser);<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> $ptickets->LimitQueue(VALUE =>'Appforall');<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> $ptickets->LimitCustomField(CUSTOMFIELD => $afa_req_type,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> OPERATOR => "=",<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> VALUE => $afa_req_type_type);<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> $ptickets->LimitCustomField(CUSTOMFIELD => $afa_appname,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> OPERATOR => "=",<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> VALUE => "$app_name");<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> $ptickets->LimitId(VALUE=>$Ticket->Id,OPERATOR=>'<');<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> $ptickets->LimitId(VALUE=>3234491,OPERATOR=>'>');<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> $ptickets->OrderByCols({FIELD=>'Id', ORDER =>'ASC'});<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> my $pticket_id='';<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> if (my $PTicket=$ptickets->Next){<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> $pticket_id=$PTicket->Id;<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> }<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> print $Ticket->Id,"\t",$customer_id,"\t",$app_name,"PARENT-----$pticket_id\n";<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> if (defined($ARGV[0]) and $ARGV[0] eq 'set'){<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> $Ticket->AddCustomFieldValue(Field=>$afa_channel,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> Value=>$afa_chat,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> RecordTransaction=>0);<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> $Ticket->AddCustomFieldValue(Field=>$afa_req_type,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> Value=>$afa_req_type_type,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> RecordTransaction=>0);<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> $Ticket->AddCustomFieldValue(Field=>$afa_customerid,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> Value=>$customer_id,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> RecordTransaction=>0);<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> $Ticket->AddCustomFieldValue(Field=>$afa_appname,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> Value=>$app_name,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> RecordTransaction=>0);<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> if ($pticket_id ne ''){<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> $Ticket->AddLink(Type=>'RefersTo',Target=>$pticket_id,RecordTransactiosn=>0);<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> }<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> }<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> } # Ticket loop<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'>$RT::Handle->Disconnect();<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> exit;<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'>[21743] [Mon Dec 22 08:21:54 2014] [warning]: RT::Handle=HASH(0x802572660) couldn't execute the query 'SELECT COUNT(DISTINCT main.id) FROM Scrips main JOIN ObjectScrips ObjectScrips_1 ON ( ObjectScrips_1.Scrip = main.id ) JOIN ScripConditions ScripConditions_2 ON ( ScripConditions_2.id = main.ScripCondition ) WHERE (ObjectScrips_1.ObjectId = '120' OR ObjectScrips_1.ObjectId = '0') AND (ObjectScrips_1.Stage = 'TransactionBatch') AND (ScripConditions_2.ApplicableTransTypes LIKE '%AddLink%' OR ScripConditions_2.ApplicableTransTypes LIKE '%Any%') AND (main.Disabled = '0') ' at /usr/local/lib/perl5/site_perl/5.14.2/DBIx/SearchBuilder/Handle.pm line 602.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> DBIx::SearchBuilder::Handle::SimpleQuery(RT::Handle=HASH(0x802572660), "SELECT COUNT(DISTINCT main.id) FROM Scrips main JOIN ObjectSc"...) called at /usr/local/lib/perl5/site_perl/5.14.2/DBIx/SearchBuilder.pm line 295<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> DBIx::SearchBuilder::_DoCount(RT::Scrips=HASH(0x80dd41c18)) called at /opt/rt4/lib//RT/SearchBuilder.pm line 996<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> RT::SearchBuilder::_DoCount(RT::Scrips=HASH(0x80dd41c18)) called at /usr/local/lib/perl5/site_perl/5.14.2/DBIx/SearchBuilder.pm line 1471<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> DBIx::SearchBuilder::Count(RT::Scrips=HASH(0x80dd41c18)) called at /opt/rt4/lib//RT/Scrips.pm line 495<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> RT::Scrips::_FindScrips(RT::Scrips=HASH(0x80dd41c18), "Stage", "TransactionBatch", "Type", "AddLink") called at /opt/rt4/lib//RT/Scrips.pm line 343<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> RT::Scrips::Prepare(RT::Scrips=HASH(0x80dd41c18), "Type", "AddLink", "TransactionObj", RT::Transaction=HASH(0x80deae7b0), "Ticket", undef, "TicketObj", RT::Ticket=HASH(0x80dd41600), ...) called at /opt/rt4/lib//RT/Scrips.pm line 291<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> RT::Scrips::Apply(RT::Scrips=HASH(0x80dd41c18), "Stage", "TransactionBatch", "TicketObj", RT::Ticket=HASH(0x80dd41600), "TransactionObj", RT::Transaction=HASH(0x80deae7b0), "Type", "AddLink", ...) called at /opt/rt4/lib//RT/Ticket.pm line 2598<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> RT::Ticket::_ApplyTransactionBatch(RT::Ticket=HASH(0x80dd41600)) called at /opt/rt4/lib//RT/Ticket.pm line 2569<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> RT::Ticket::ApplyTransactionBatch(RT::Ticket=HASH(0x80dd41600)) called at /opt/rt4/lib//RT/Ticket.pm line 2639<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> RT::Ticket::DESTROY(RT::Ticket=HASH(0x80dd41600)) called at 02.pl line 149<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> eval {...} called at 02.pl line 149 (/usr/local/lib/perl5/site_perl/5.14.2/Carp.pm:169)<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'>[82765] [Thu Dec 25 04:19:52 2014] [warning]: RT::Handle=HASH(0x802572648) couldn't execute the query 'SELECT * FROM Tickets WHERE id = ?' at /usr/local/lib/perl5/site_perl/5.14.2/DBIx/SearchBuilder/Handle.pm line 602.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> DBIx::SearchBuilder::Handle::SimpleQuery(RT::Handle=HASH(0x802572648), "SELECT * FROM Tickets WHERE id = ?", 3330370) called at /usr/local/lib/perl5/site_perl/5.14.2/DBIx/SearchBuilder/Record.pm line 1234<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> DBIx::SearchBuilder::Record::_LoadFromSQL(RT::Ticket=HASH(0x80beca300), "SELECT * FROM Tickets WHERE id = ?", 3330370) called at /usr/local/lib/perl5/site_perl/5.14.2/DBIx/SearchBuilder/Record.pm line 1153<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> DBIx::SearchBuilder::Record::LoadByCols(RT::Ticket=HASH(0x80beca300), "id", 3330370) called at /usr/local/lib/perl5/site_perl/5.14.2/DBIx/SearchBuilder/Record/Cachable.pm line 120<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> DBIx::SearchBuilder::Record::Cachable::LoadByCols(RT::Ticket=HASH(0x80beca300), "id", 3330370) called at /opt/rt4/lib//RT/Record.pm line 396<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> RT::Record::LoadByCols(RT::Ticket=HASH(0x80beca300), "id", 3330370) called at /usr/local/lib/perl5/site_perl/5.14.2/DBIx/SearchBuilder/Record.pm line 1168<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> DBIx::SearchBuilder::Record::LoadById(RT::Ticket=HASH(0x80beca300), 3330370) called at /opt/rt4/lib//RT/Ticket.pm line 146<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> RT::Ticket::Load(RT::Ticket=HASH(0x80beca300), 3330370) called at /opt/rt4/lib//RT/Ticket.pm line 2581<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> RT::Ticket::_ApplyTransactionBatch(RT::Ticket=HASH(0x80becab88)) called at /opt/rt4/lib//RT/Ticket.pm line 2569<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> RT::Ticket::ApplyTransactionBatch(RT::Ticket=HASH(0x80becab88)) called at /opt/rt4/lib//RT/Ticket.pm line 2639<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> RT::Ticket::DESTROY(RT::Ticket=HASH(0x80becab88)) called at 02.pl line 149<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'> eval {...} called at 02.pl line 149 (/usr/local/lib/perl5/site_perl/5.14.2/Carp.pm:169)<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'>[82765] [Thu Dec 25 04:19:52 2014] [warning]: TransactionBatch was fired on a ticket that no longer exists; unable to run scrips! Call ->ApplyTransactionBatch before shredding the ticket, for consistent results. (/opt/rt4/lib//RT/Ticket.pm:2588)<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Tahoma",sans-serif;color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><b><span style='font-size:11.0pt;font-family:"Calibri",sans-serif'>From:</span></b><span style='font-size:11.0pt;font-family:"Calibri",sans-serif'> Alex Peters [<a href="mailto:alex@peters.net">mailto:alex@peters.net</a>] <br><b>Sent:</b> Wednesday, December 17, 2014 2:31 PM<br><b>To:</b> Payam Poursaied; <a href="mailto:rt-users@lists.bestpractical.com">rt-users@lists.bestpractical.com</a><br><b>Subject:</b> Re: [rt-users] warning message on set ReferTo<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><p>I can't see any obvious problems based on your error messages.<o:p></o:p></p><p>There seems to be a typo in the code. Is that directly copied from your script?<o:p></o:p></p><p>Have you considered enabling debugging from within your script?<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal>On Thu, 18 Dec 2014 5:04 am Payam Poursaied <<a href="mailto:me@payam124.com">me@payam124.com</a>> wrote:<o:p></o:p></p><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt'><p class=MsoNormal style='margin-bottom:12.0pt'>Hi All<br>I have created a script which has below command to create a link<br>$Ticket->AddLink(Type=>'RefersTo',Target=>$pticket_id,RecordTransactiosn=>0)<br>;<br><br>When I run the script ReferTo link created, but I got below warning as well.<br>RT version 4.2.8<br>And line 149 of <a href="http://02.pl" target="_blank">02.pl</a> is exit line.<br><br>Any idea?<br><br>[85829] [Wed Dec 17 07:14:20 2014] [warning]: RT::Handle=HASH(0x802572648)<br>couldn't execute the query 'SELECT * FROM Tickets WHERE id = ?' at<br>/usr/local/lib/perl5/site_perl/5.14.2/DBIx/SearchBuilder/Handle.pm line 602.<br> <br>DBIx::SearchBuilder::Handle::SimpleQuery(RT::Handle=HASH(0x802572648),<br>"SELECT * FROM Tickets WHERE id = ?", 3311056) called at<br>/usr/local/lib/perl5/site_perl/5.14.2/DBIx/SearchBuilder/Record.pm line 1234<br> <br>DBIx::SearchBuilder::Record::_LoadFromSQL(RT::Ticket=HASH(0x80e255cf0),<br>"SELECT * FROM Tickets WHERE id = ?", 3311056) called at<br>/usr/local/lib/perl5/site_perl/5.14.2/DBIx/SearchBuilder/Record.pm line 1153<br> <br>DBIx::SearchBuilder::Record::LoadByCols(RT::Ticket=HASH(0x80e255cf0), "id",<br>3311056) called at<br>/usr/local/lib/perl5/site_perl/5.14.2/DBIx/SearchBuilder/Record/Cachable.pm<br>line 120<br> <br>DBIx::SearchBuilder::Record::Cachable::LoadByCols(RT::Ticket=HASH(0x80e255cf<br>0), "id", 3311056) called at /opt/rt4/lib//RT/Record.pm line 396<br> RT::Record::LoadByCols(RT::Ticket=HASH(0x80e255cf0), "id", 3311056)<br>called at /usr/local/lib/perl5/site_perl/5.14.2/DBIx/SearchBuilder/Record.pm<br>line 1168<br> DBIx::SearchBuilder::Record::LoadById(RT::Ticket=HASH(0x80e255cf0),<br>3311056) called at /opt/rt4/lib//RT/Ticket.pm line 146<br> RT::Ticket::Load(RT::Ticket=HASH(0x80e255cf0), 3311056) called at<br>/opt/rt4/lib//RT/Ticket.pm line 2581<br> RT::Ticket::_ApplyTransactionBatch(RT::Ticket=HASH(0x80dd1a9f0))<br>called at /opt/rt4/lib//RT/Ticket.pm line 2569<br> RT::Ticket::ApplyTransactionBatch(RT::Ticket=HASH(0x80dd1a9f0))<br>called at /opt/rt4/lib//RT/Ticket.pm line 2639<br> RT::Ticket::DESTROY(RT::Ticket=HASH(0x80dd1a9f0)) called at <a href="http://02.pl" target="_blank">02.pl</a><br>line 149<br> eval {...} called at <a href="http://02.pl" target="_blank">02.pl</a> line 149<br>(/usr/local/lib/perl5/site_perl/5.14.2/Carp.pm:169)<o:p></o:p></p></blockquote></div></div></body></html>