OK and thanks for your help.<div><br></div><div>Here is the Scrip. I verify if the transaction is a change in a Custom Field called 'Fim do evento' and then, change the value of another Custom Field to a test value.<div>
The problem is that when I change the CustomField via WebInterface, it runs my scrip, change the values to 'teste', and then change again to what was set before.</div><div><div><br></div><div>Custom Condition:</div>
<div><div>if ( $self->TransactionObj->Type ne "CustomField"){</div><div> return 0;</div><div>}</div><div>return 1;</div><div><br></div><div>Preparation</div><div>1;</div><div><br></div><div>Cleanup</div>
<div><div>my $ticket = $self->TicketObj;</div><div>my $CFName = 'Fim do evento';</div><div>my $CF = RT::CustomField->new( $RT::SystemUser );</div><div>$CF->LoadByNameAndQueue( Name => $CFName, Queue => $ticket->Queue );</div>
<div>unless( $CF->id ) {</div><div> $CF->LoadByNameAndQueue( Name => $CFName, Queue => '0' );</div><div>}</div><div>if ($self->TransactionObj->Field ne $CF->id){</div><div> return 0;</div>
<div>}</div><div><br></div><div>$CFName = 'Indisponibilidade';</div><div>$CF = RT::CustomField->new( $RT::SystemUser );</div><div>$CF->LoadByNameAndQueue( Name => $CFName, Queue => $ticket->Queue );</div>
<div>unless( $CF->id ) {</div><div> $CF->LoadByNameAndQueue( Name => $CFName, Queue => '0' );</div><div>}</div><div><br></div><div>unless( $CF->id ) {</div><div> $RT::Logger->error( "No field $CFName in queue ". $ticket->QueueObj->Name );</div>
<div> return undef;</div><div>}</div><div>my $Value = 'test';</div><div>$ticket->AddCustomFieldValue( Field => $CF, Value => $Value );</div><div><br></div><div>return 1;</div><div><br></div></div><div><div>
<br><div class="gmail_quote">2010/4/19 Kenneth Crocker <span dir="ltr"><<a href="mailto:kfcrocker@lbl.gov">kfcrocker@lbl.gov</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Segio,<br><br>It sounds like your stage is "TransactionCreate". Even if you set it to "TransactionBatch", you <b>ALSO</b> have to <b>TURN IT ON</b> in the "etc/RT_SiteConfig.pm" file. If you don't, it will either reverse the setting or just ignore the setting, I'm not sure which, but the main thing is that it won't work. Take a look at it.<br>
<br>Kenn<br>LBNL<br><br><div class="gmail_quote"><div><div></div><div class="h5">On Mon, Apr 19, 2010 at 9:54 AM, Sergio Charpinel Jr. <span dir="ltr"><<a href="mailto:sergiocharpinel@gmail.com" target="_blank">sergiocharpinel@gmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex"><div><div></div><div class="h5">
Sorry, It is getting executed, but the custom field is changing twice too.<br>I need my scrip executing after the custom fields updates. Is this possible? Or is there another way to do this?<br><br><div class="gmail_quote">
2010/4/19 Raed El-Hames <span dir="ltr"><<a href="mailto:rfh@vialtus.com" target="_blank">rfh@vialtus.com</a>></span><div><br><blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">
<div><br>
Sergio Charpinel Jr. wrote:<br>
<blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">
Thanks for your answers. <br>
Actually, I wanna change a custom field based in a change of another one. So, trying what Raed said, I wrote a Custom Condition to verify if it is a custom condition change.<br>
But I had the same problem.. When I update via Web interface, the Custom Field is changed twice, in TransactionCreate, and in Transactionbatch the scrip is not executed.<br>
<br>
</blockquote></div>
Do you know why the (Transactionbatch) scrip is not executed ?? is there any perl errors ? have you checked the logs<br>
<br>
Roy<br>
<br>
<br>
<blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">
Any ideas?<br>
<br>
</blockquote>
<br>
<br>
</blockquote></div></div><font color="#888888"><br><br clear="all"><br>-- <br>Sergio Roberto Charpinel Jr.<br>
</font><br><br></div></div><div class="im">
Discover RT's hidden secrets with RT Essentials from O'Reilly Media.<br>
Buy a copy at <a href="http://rtbook.bestpractical.com" target="_blank">http://rtbook.bestpractical.com</a><br></div></blockquote></div><br>
</blockquote></div><br><br clear="all"><br>-- <br>Sergio Roberto Charpinel Jr.<br>
</div></div></div></div></div>