[rt-users] script : custom action by ticket creation or modification

2010-06-29 Thread Horst Kriegers
Hello,
 
the following scrip works only On transaction but not wen a new
ticket is created.
What is wrong ?
 
 
- Condition : User Defined
- Custom condition :
 
my $trans = $self-TransactionObj;
my $ticket = $self-TicketObj;
 
if ($trans-Type eq 'CustomField') {
  my $cf = new RT::CustomField($RT::SystemUser);
  $cf-LoadByName(Queue = $ticket-QueueObj-id, Name =
Qualification sécurité);
  return 0 unless $cf-id;
  
  if ($trans-Field == $cf-id  $trans-NewValue eq Oui) {
return 1;
  }
  
}
return 0; 
 
 
 
Thanks in advance for your help.
Horst

___
Le contenu de ce courriel est uniquement réservé à la personne ou 
l'organisme à qui il est destiné. Si vous n'êtes pas le destinataire
prévu, veuillez nous en informer au plus vite et détruire le présent
courriel. Dans ce cas, il ne vous est pas permis de copier ce courriel,
de le distribuer ou de l'utiliser de quelque manière que ce soit.

The content of this e-mail is intended only and solely for the use 
of the named recipient or organisation. If you are not the named 
recipient, please inform us immediately and delete the present e-mail. 
In this case, you are nor allowed to copy, distribute or use this 
e-mail in any way.
___

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

Re: [rt-users] script : custom action by ticket creation or modification

2010-06-29 Thread Kevin Falcone
On Tue, Jun 29, 2010 at 10:09:19AM +0200, Horst Kriegers wrote:
the following scrip works only On transaction but not wen a new ticket 
 is created.
What is wrong ?

Your condition says only work when this is a custom field change, it
doesn't consider Create types at all.

-kevin

- Condition : User Defined
- Custom condition :
 
my $trans = $self-TransactionObj;
my $ticket = $self-TicketObj;
 
if ($trans-Type eq 'CustomField') {
  my $cf = new RT::CustomField($RT::SystemUser);
  $cf-LoadByName(Queue = $ticket-QueueObj-id, Name = Qualification 
 securite);
  return 0 unless $cf-id;
 
  if ($trans-Field == $cf-id  $trans-NewValue eq Oui) {
return 1;
  }
 
}
return 0;


pgprCEDbwiqQu.pgp
Description: PGP signature

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