Re: [rt-users] TransactionBatch - AddCustomFieldValue

2010-04-20 Thread Sergio Charpinel Jr.
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.

Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Re: [rt-users] TransactionBatch - AddCustomFieldValue

2010-04-20 Thread Sergio Charpinel Jr.
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

Re: [rt-users] TransactionBatch - AddCustomFieldValue

2010-04-19 Thread Sergio Charpinel Jr.
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.

Any ideas?

2010/4/16 Kenneth Crocker kfcroc...@lbl.gov

 Sergio,

 Your scrips have different conditions, so they are completely separate
 transaction. Look at any scrips that are triggered by the status changing to
 resolved and see what is happening to the Custom Fields AND check the
 stage to see if it is TransactionBatch. Hope this helps.

 Kenn
 LBNL

 On Fri, Apr 16, 2010 at 10:12 AM, Sergio Charpinel Jr. 
 sergiocharpi...@gmail.com wrote:

 Yes, that was happening in TransactionCreate.

 So, I found people with similar problems that solved this using
 TransactionBatch, because the scrip is executed later. But, when I change
 status to resolved, the CustomField does not get changed (in
 TransactionCreate it was twice).
 I dont know why this is happening.

 2010/4/16 Raed El-Hames r...@vialtus.com

  Are you creating the ticket from the web interface and that custom field
 exist in the form;
 Most likely the script is changing it to the value you want, then its
 changing again to the value given in the form while processing the form ??
 Is that what is happening??
 If its , I would suggest you change your scrip condition to Userdefined
 and look for Custom Field create or change
 something similar to
 http://wiki.bestpractical.com/view/OnCustomFieldValueChange

 Regards;
 Roy


 Sergio Charpinel Jr. wrote:

 Hi,

 I'm trying to change a CustomField value in OnCreate event.
 I cant use TransactionCreate stage, because when I resolve the ticket
 via Web Interface, it changes again my custom field value to what it was.

 So, I'm trying to use TransactionBatch stage, but the field is not
 changed. And the script is get executed.

 What am I doing wrong??
 Thanks for any help.

 --
 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





-- 
Sergio Roberto Charpinel Jr.

Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Re: [rt-users] TransactionBatch - AddCustomFieldValue

2010-04-19 Thread Raed El-Hames


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?





Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
Buy a copy at http://rtbook.bestpractical.com


Re: [rt-users] TransactionBatch - AddCustomFieldValue

2010-04-19 Thread Sergio Charpinel Jr.
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

Re: [rt-users] TransactionBatch - AddCustomFieldValue

2010-04-19 Thread Raed El-Hames
Can you send us the scrip so we can look at for you, include your 
condition and action ..
Also can you reiterate what you are trying to achieve , from your 
previous thread it seems to me you want a custom field to always have 
the same value, if this is the case then I would hide it from the form 
to begin with, which would be the easiest way of dealing with this.


Regards;
Roy







Sergio Charpinel Jr. 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 mailto: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


[rt-users] TransactionBatch - AddCustomFieldValue

2010-04-16 Thread Sergio Charpinel Jr.
Hi,

I'm trying to change a CustomField value in OnCreate event.
I cant use TransactionCreate stage, because when I resolve the ticket via
Web Interface, it changes again my custom field value to what it was.

So, I'm trying to use TransactionBatch stage, but the field is not changed.
And the script is get executed.

What am I doing wrong??

Thanks for any help.

-- 
Sergio Roberto Charpinel Jr.

Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Re: [rt-users] TransactionBatch - AddCustomFieldValue

2010-04-16 Thread Raed El-Hames
Are you creating the ticket from the web interface and that custom field 
exist in the form;
Most likely the script is changing it to the value you want, then its 
changing again to the value given in the form while processing the form ??

Is that what is happening??
If its , I would suggest you change your scrip condition to Userdefined 
and look for Custom Field create or change
something similar to 
http://wiki.bestpractical.com/view/OnCustomFieldValueChange


Regards;
Roy

Sergio Charpinel Jr. wrote:

Hi,

I'm trying to change a CustomField value in OnCreate event.
I cant use TransactionCreate stage, because when I resolve the ticket 
via Web Interface, it changes again my custom field value to what it was.


So, I'm trying to use TransactionBatch stage, but the field is not 
changed. And the script is get executed.


What am I doing wrong?? 


Thanks for any help.

--
Sergio Roberto Charpinel Jr.


Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
Buy a copy at http://rtbook.bestpractical.com


Re: [rt-users] TransactionBatch - AddCustomFieldValue

2010-04-16 Thread Sergio Charpinel Jr.
Yes, that was happening in TransactionCreate.

So, I found people with similar problems that solved this using
TransactionBatch, because the scrip is executed later. But, when I change
status to resolved, the CustomField does not get changed (in
TransactionCreate it was twice).
I dont know why this is happening.

2010/4/16 Raed El-Hames r...@vialtus.com

 Are you creating the ticket from the web interface and that custom field
 exist in the form;
 Most likely the script is changing it to the value you want, then its
 changing again to the value given in the form while processing the form ??
 Is that what is happening??
 If its , I would suggest you change your scrip condition to Userdefined and
 look for Custom Field create or change
 something similar to
 http://wiki.bestpractical.com/view/OnCustomFieldValueChange

 Regards;
 Roy


 Sergio Charpinel Jr. wrote:

 Hi,

 I'm trying to change a CustomField value in OnCreate event.
 I cant use TransactionCreate stage, because when I resolve the ticket via
 Web Interface, it changes again my custom field value to what it was.

 So, I'm trying to use TransactionBatch stage, but the field is not
 changed. And the script is get executed.

 What am I doing wrong??
 Thanks for any help.

 --
 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