Thanks for your help, now it is working. I changed a little the code, and I was forgetting to refresh the page :x I'm using TransactionBatch.
Cheers. 2010/4/20 Sergio Charpinel Jr. <sergiocharpi...@gmail.com> > OK and thanks for your help. > > 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. > 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. > > Custom Condition: > if ( $self->TransactionObj->Type ne "CustomField"){ > return 0; > } > return 1; > > Preparation > 1; > > Cleanup > my $ticket = $self->TicketObj; > my $CFName = 'Fim do evento'; > my $CF = RT::CustomField->new( $RT::SystemUser ); > $CF->LoadByNameAndQueue( Name => $CFName, Queue => $ticket->Queue ); > unless( $CF->id ) { > $CF->LoadByNameAndQueue( Name => $CFName, Queue => '0' ); > } > if ($self->TransactionObj->Field ne $CF->id){ > return 0; > } > > $CFName = 'Indisponibilidade'; > $CF = RT::CustomField->new( $RT::SystemUser ); > $CF->LoadByNameAndQueue( Name => $CFName, Queue => $ticket->Queue ); > unless( $CF->id ) { > $CF->LoadByNameAndQueue( Name => $CFName, Queue => '0' ); > } > > unless( $CF->id ) { > $RT::Logger->error( "No field $CFName in queue ". $ticket->QueueObj->Name > ); > return undef; > } > my $Value = 'test'; > $ticket->AddCustomFieldValue( Field => $CF, Value => $Value ); > > return 1; > > > 2010/4/19 Kenneth Crocker <kfcroc...@lbl.gov> > > Segio, >> >> It sounds like your stage is "TransactionCreate". Even if you set it to >> "TransactionBatch", you *ALSO* have to *TURN IT ON* 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. >> >> Kenn >> LBNL >> >> On Mon, Apr 19, 2010 at 9:54 AM, Sergio Charpinel Jr. < >> sergiocharpi...@gmail.com> wrote: >> >>> Sorry, It is getting executed, but the custom field is changing twice >>> too. >>> I need my scrip executing after the custom fields updates. Is this >>> possible? Or is there another way to do this? >>> >>> 2010/4/19 Raed El-Hames <r...@vialtus.com> >>> >>> >>>> Sergio Charpinel Jr. wrote: >>>> >>>>> Thanks for your answers. >>>>> 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. >>>>> 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. >>>>> >>>>> Do you know why the (Transactionbatch) scrip is not executed ?? is >>>> there any perl errors ? have you checked the logs >>>> >>>> Roy >>>> >>>> >>>> Any ideas? >>>>> >>>>> >>>> >>>> >>> >>> >>> -- >>> Sergio Roberto Charpinel Jr. >>> >>> >>> Discover RT's hidden secrets with RT Essentials from O'Reilly Media. >>> Buy a copy at http://rtbook.bestpractical.com >>> >> >> > > > -- > Sergio Roberto Charpinel Jr. > -- Sergio Roberto Charpinel Jr.
Discover RT's hidden secrets with RT Essentials from O'Reilly Media. Buy a copy at http://rtbook.bestpractical.com