my $TransactionPreviousStatus = $self->TicketObj->Status->OldValue
:
I am thinking this should give the old status but I end up getting the current status
For Ex:
Old status: open
Current Status: reply-pls
So when somebody will reply on the ticket, a custom script will execute which should change the status to old value (i.e., open) but again it goes back to reply-pls.
You can not call OldValue on TicketObj, it's a Transaction method. So if I understand your needs correctly, you need to write a scrip which triggers on StatusChange && Correspondence which sets the status back. This is little bit tricky.
AFAIK you need to create a batch scrip which triggers on Correspondence and then find the last transaction of StatusChange and revert it back. Something like this could work: