TransactionBatch Question

I’m playing with the TransactionBatch feature and I’m curious: if you use
$self->TransactionObj in a custom scrip condition for a TransactionBatch
scrip, what do you get? My understanding is that this stage does not
execute in the context of a transaction.

Steve

Stephen Turner
Sr. Analyst/Programmer
MIT IS&T - SAIS

Stephen,

I use it a lot. My understanding, and experience, is that with 

TransdactionCreate, the scrip you write may not execute until after
certain built-in RT transactions have executed (with commit) and with
TransactionBatch, they all execute in sequence (alphabetical) followed
by the commit. I may have the terminology wrong here, but that’s my
experience. Therefore, I have re-named many of my scrips to run in a
certain sequence. When I have a template that is using a CF that is
updated in a scrip, it doesn’t always show unless I set the scrips for
TransactionBatch.
Another thing I noticed. When I ran a scrip with TransactionBatch
and added some CC’s in the Prep Action section, several notification
scrips for CC’s executed. But when I set those CC’s in Cleanup Action,
all other scrips had already executed so the CC notification scrips did
not kick off (which was what I wanted in the first place).
I may not be technically correct on some of this, but that’s what I
have noticed. Hope this helps.

Kenn
LBNLOn 6/1/2009 7:01 AM, Stephen Turner wrote:

I’m playing with the TransactionBatch feature and I’m curious: if you use
$self->TransactionObj in a custom scrip condition for a TransactionBatch
scrip, what do you get? My understanding is that this stage does not
execute in the context of a transaction.

Steve

I’m playing with the TransactionBatch feature and I’m curious: if you use
$self->TransactionObj in a custom scrip condition for a TransactionBatch
scrip, what do you get? My understanding is that this stage does not
execute in the context of a transaction.

It does, you get first transaction that matched the condition, so
not-batch-mode-aware scrips can still work as expected.

Steve


Stephen Turner
Sr. Analyst/Programmer
MIT IS&T - SAIS


http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sales@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.

I’m playing with the TransactionBatch feature and I’m curious: if you
use
$self->TransactionObj in a custom scrip condition for a TransactionBatch
scrip, what do you get? My understanding is that this stage does not
execute in the context of a transaction.

It does, you get first transaction that matched the condition, so
not-batch-mode-aware scrips can still work as expected.

Ah, thanks, I almost understand it now! So, is the scrip invoked once per
transaction until a transaction matches the scrip condition?

I’m testing with a simple scrip that just returns a value from the custom
condition, and I update a ticket with status change and two CF changes. If
the scrip returns 0, I see the scrip being invoked three times, once for
each of the field-change transactions. If the scrip returns 1, it runs
only once.

Steve

I’m playing with the TransactionBatch feature and I’m curious: if you use
$self->TransactionObj in a custom scrip condition for a TransactionBatch
scrip, what do you get? My understanding is that this stage does not
execute in the context of a transaction.

It does, you get first transaction that matched the condition, so
not-batch-mode-aware scrips can still work as expected.

Ah, thanks, I almost understand it now! So, is the scrip invoked once per
transaction until a transaction matches the scrip condition?

I’m testing with a simple scrip that just returns a value from the custom
condition, and I update a ticket with status change and two CF changes. If
the scrip returns 0, I see the scrip being invoked three times, once for
each of the field-change transactions. If the scrip returns 1, it runs only
once.

Steve, sorry, but I can’t say that I fully understand your
description, but conditions of batch scrips tested on every
transaction in a batch, but process stops as soon as we find a match.
We don’t want to fire the same scrip multiple times on the same batch.

For example batch has status, queue and two cfs change.

  • If a condition fires its scrip on correspond then the scrip action
    wouldn’t be applied. All txns in the batch would be checked against
    the condition.
  • if a condition fires its scrip on queue change then the scrip action
    would be applied and default transaction accessor will point to queue
    change. The condition wouldn’t be checked against cf changes.
  • if a condition fires its scrip on any cf change then the scrip
    action would be applied and default transaction accessor will point to
    the first cf change. The condition wouldn’t be checked against other
    transacactions after the first change in a cf.

Something like that, hope it helps.

Steve

Best regards, Ruslan.

Steve, sorry, but I can’t say that I fully understand your
description, but conditions of batch scrips tested on every
transaction in a batch, but process stops as soon as we find a match.
We don’t want to fire the same scrip multiple times on the same batch.

For example batch has status, queue and two cfs change.

  • If a condition fires its scrip on correspond then the scrip action
    wouldn’t be applied. All txns in the batch would be checked against
    the condition.
  • if a condition fires its scrip on queue change then the scrip action
    would be applied and default transaction accessor will point to queue
    change. The condition wouldn’t be checked against cf changes.
  • if a condition fires its scrip on any cf change then the scrip
    action would be applied and default transaction accessor will point to
    the first cf change. The condition wouldn’t be checked against other
    transacactions after the first change in a cf.

Something like that, hope it helps.

Steve

I think I’ve got it now! Thanks for your help Ruslan,

Steve

Stephen Turner
Sr. Analyst/Programmer
MIT IS&T - SAIS