How does $Transaction->OldValue exactly work


#1

Hi folks,
do you somewho know how the TransactionObj OldValue and NewValue functions should work? I don’t think it’s only about transaction but about the state of the ticket at whole. For example if I try to write a scrip on queue change, then I can load all AdminCcs from previous queue:
(in template)

my $q1 = new RT::Queue($RT::SystemUser);
$q1->Load($Transaction->OldValue);
my $addr = $q1->AdminCcAddresses();

Notice that I am loading the old value of transaction but then working with Queue. So I can work through old transaction data with other objects.

When I try something similar with priority (on priority change):

  my $t1 = new RT::Ticket($RT::SystemUser);
  $t1->Load($Transaction->OldValue);
  $t1->Priority;

I always get 0 which is not correct.

And NewValue data are not available in the scrip at the moment, unless the scrip is run in batch mode. So I don’t understand what the function is for :slight_smile:


#2

Oldvalue is the integer value of the appropriate type. For change queue it’s the old queue index, for change priority it’s the old priority, etc. The old priority is no longer in the ticket object.