<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:x="urn:schemas-microsoft-com:office:excel" xmlns:p="urn:schemas-microsoft-com:office:powerpoint" xmlns:a="urn:schemas-microsoft-com:office:access" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema" xmlns:b="urn:schemas-microsoft-com:office:publisher" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:c="urn:schemas-microsoft-com:office:component:spreadsheet" xmlns:odc="urn:schemas-microsoft-com:office:odc" xmlns:oa="urn:schemas-microsoft-com:office:activation" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:q="http://schemas.xmlsoap.org/soap/envelope/" xmlns:rtc="http://microsoft.com/officenet/conferencing" xmlns:D="DAV:" xmlns:Repl="http://schemas.microsoft.com/repl/" xmlns:mt="http://schemas.microsoft.com/sharepoint/soap/meetings/" xmlns:x2="http://schemas.microsoft.com/office/excel/2003/xml" xmlns:ppda="http://www.passport.com/NameSpace.xsd" xmlns:ois="http://schemas.microsoft.com/sharepoint/soap/ois/" xmlns:dir="http://schemas.microsoft.com/sharepoint/soap/directory/" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:dsp="http://schemas.microsoft.com/sharepoint/dsp" xmlns:udc="http://schemas.microsoft.com/data/udc" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:sub="http://schemas.microsoft.com/sharepoint/soap/2002/1/alerts/" xmlns:ec="http://www.w3.org/2001/04/xmlenc#" xmlns:sp="http://schemas.microsoft.com/sharepoint/" xmlns:sps="http://schemas.microsoft.com/sharepoint/soap/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:udcs="http://schemas.microsoft.com/data/udc/soap" xmlns:udcxf="http://schemas.microsoft.com/data/udc/xmlfile" xmlns:udcp2p="http://schemas.microsoft.com/data/udc/parttopart" xmlns:wf="http://schemas.microsoft.com/sharepoint/soap/workflow/" xmlns:dsss="http://schemas.microsoft.com/office/2006/digsig-setup" xmlns:dssi="http://schemas.microsoft.com/office/2006/digsig" xmlns:mdssi="http://schemas.openxmlformats.org/package/2006/digital-signature" xmlns:mver="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns:mrels="http://schemas.openxmlformats.org/package/2006/relationships" xmlns:spwp="http://microsoft.com/sharepoint/webpartpages" xmlns:ex12t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:ex12m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:pptsl="http://schemas.microsoft.com/sharepoint/soap/SlideLibrary/" xmlns:spsl="http://microsoft.com/webservices/SharePointPortalServer/PublishedLinksService" xmlns:Z="urn:schemas-microsoft-com:" xmlns:st="" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-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;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;}
@page Section1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.Section1
{page:Section1;}
-->
</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=FR link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal><span lang=EN-US>Hello,<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US>I try to keep the date of a Owner changed
event.<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>To do this, I use a scrip to write this
date value in a CustomField named "LastOwnerChangeDate".<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US>Condition: "On Owner Change"<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>Action: "User Defined"<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>Template: "Global Template:
Blank"<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>Stage: "TransactionCreate"<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US>Custom condition:<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>return 1;<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US>Custom action preparation code:<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>my $trans = $self->TransactionObj; <o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>my $ticket = $self->TicketObj; <o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>my $cf_obj =
RT::CustomField->new($RT::SystemUser); <o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>my $cf_name =
"LastOwnerChangeDate"; <o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>my $cf_value = $trans->CreatedAsString; <o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US>$cf_obj->LoadByName(Name=>$cf_name);<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>$RT::Logger->debug("Loaded\$cf_obj->Name
= ". $cf_obj->Name() ."\n"); <o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>$ticket->AddCustomFieldValue(Field=>$cf_obj,
Value=>$cf_value, RecordTransaction=>0); <o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>return 1;<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US>Custom action cleanup code:<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>return 1;<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US>It is almost working... :<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>- When I steal a ticket it works.<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>- When I give a ticket from the
"People" section it works.<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>- When I give a ticket from the
"Basics" or "Jumbo" section, the date is not changed...
And here is my issue!<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US>In fact, I think that RT begin by
evaluating that the owner is changed so the CustomField
"LastOwnerChangeDate" is replaced to the new value by the scrip (OK,
that's good!).<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>But then RT evaluates the Field
"LastOwnerChangeDate" in the web form... RT see the old value in the
field (the new one is already in the DB) and replace the new value by the old
one...<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>Maybe I’m wrong but this is what I
understand from the logs.<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US>Logs for "Steal" or
"Give" in the "People" section:<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>Jun 6 13:37:06 rt-support RT: About to
think about scrips for transaction #112<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>Jun 6 13:37:06 rt-support RT: About to
prepare scrips for transaction #112<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>Jun 6 13:37:06 rt-support RT: Found 1
scrips for TransactionCreate stage with applicable type(s) Steal<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>Jun 6 13:37:06 rt-support RT:
Loaded$cf_obj->Name = LastOwnerChangeDate<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>Jun 6 13:37:06 rt-support RT: About to
commit scrips for transaction #112<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>Jun 6 13:37:06 rt-support RT: Committing
scrip #12 on txn #112 of ticket #1<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>Jun 6 13:37:06 rt-support RT: Found 0
scrips for TransactionBatch stage with applicable type(s) Steal<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US>Logs for "Give" in the
"Basics" or "Jumbo" section:<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>Jun 6 13:36:45 rt-support RT: About to
think about scrips for transaction #110<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>Jun 6 13:36:45 rt-support RT: About to
prepare scrips for transaction #110<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>Jun 6 13:36:45 rt-support RT: Found 1
scrips for TransactionCreate stage with applicable type(s) Give<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>Jun 6 13:36:45 rt-support RT:
Loaded$cf_obj->Name = LastOwnerChangeDate<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>Jun 6 13:36:45 rt-support RT: About to
commit scrips for transaction #110<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>Jun 6 13:36:45 rt-support RT: Committing
scrip #12 on txn #110 of ticket #1<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>Jun 6 13:36:45 rt-support RT: About to
think about scrips for transaction #111<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>Jun 6 13:36:45 rt-support RT: About to
prepare scrips for transaction #111<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>Jun 6 13:36:45 rt-support RT: Found 1
scrips for TransactionCreate stage with applicable type(s) CustomField<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>Jun 6 13:36:45 rt-support RT: About to
commit scrips for transaction #111<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>Jun 6 13:36:45 rt-support RT: Found 0
scrips for TransactionBatch stage with applicable type(s) Give,CustomField<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US>How can I make it works without this issue
?<o:p></o:p></span></p>
<p class=MsoNormal>Thanks.<o:p></o:p></p>
</div>
</body>
</html>