[rt-users] scrips with more than one transaction

Ruslan Zakirov ruz at bestpractical.com
Fri May 16 10:41:21 EDT 2008


TransactionBatch may be tricky, if you want condition "When CF X is
set to 'work' from empty" then you can implement the following pseudo
code:

if ($txn_type eq 'Create') {
   return 1 if $self->TicketObj->FirstCustomFieldValue('cf') eq 'work'
   return 0;
}
if ($txn_type eq 'CustomField') {
   return 0 unless $txn_field = $cf_id;
   return 0 if $txn_old_value; # field had not empty value
   return 0 unless $txn_new_value eq 'work';
   return 1;
}
return 0;

On Fri, May 16, 2008 at 5:37 PM, Alexandre de Medeiros Ribeiro
<alexandre.medeiros at camara.gov.br> wrote:
> Hi all,
>
>     I want create this scrip:
>
>     condition: user defined
>     action: create tickets
>     template: my template
>     stage : transaction create
>
>     custom condition:
>
>         #test if this ticket is now created
>         return 0 unless $self->TransactionObj->Type() eq 'Create';
>
>         #test if my cf has value 'work'
>         return 0 unless  $self->TicketObj->FirstCustomFieldValue('cf') eq
> 'work';
>
>         return 1;
>
> =================
>            My second test doesn't work because when the transaction type  is
> create
> the value of cf is null (2 diferent transactions).
>             How can i solve this problem?
>
>
> _______________________________________________
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
>
> Community help: http://wiki.bestpractical.com
> Commercial support: sales at bestpractical.com
>
>
> Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
> Buy a copy at http://rtbook.bestpractical.com
>



-- 
Best regards, Ruslan.



More information about the rt-users mailing list