RT 5.0.2 TransactionObj->Type always return 'Set'

Hello, appreciate if can get advice. I would like to change the ticket’s Status to ‘taken’ from new after i ‘take’ the ticket.

My Script below,
Condition: On Owner change
Action: User Defined
Template: Blank

User Defined condition and results
Custom condition: return 1;
Custom action preparation code: return 1;
Custom action commit code:
$RT::Logger->info(’"-----Debug---- TransactionObj Type = '. $self->TransactionObj->Type);
if ($self->TransactionObj->Type eq ‘Take’ ) {
$self->TicketObj->SetStatus(‘taken’);
}
return 1;

Below part of the log file showing:

[52014] [Mon Mar 21 04:55:19 2022] [info]: "-----Debug---- TransactionObj Type = Set ((eval 1573):1)
[52014] [Mon Mar 21 04:55:19 2022] [debug]: About to prepare scrips for transaction #191087 (/opt/rt5/sbin/…/lib/RT/Transaction.pm:189)
[52014] [Mon Mar 21 04:55:19 2022] [debug]: Found 2 scrips for TransactionCreate stage with applicable type(s) SetWatcher for txn #191087 on ticket #20504 (/opt/rt5/sbin/…/lib/RT/Scrips.pm:477)
[52014] [Mon Mar 21 04:55:19 2022] [debug]: Skipping Scrip #31 because it isn’t applicable (/opt/rt5/sbin/…/lib/RT/Scrips.pm:337)
[52014] [Mon Mar 21 04:55:19 2022] [debug]: About to commit scrips for transaction #191087 (/opt/rt5/sbin/…/lib/RT/Transaction.pm:212)
[52014] [Mon Mar 21 04:55:19 2022] [debug]: Committing scrip #24 on txn #191087 of ticket #20504 (/opt/rt5/sbin/…/lib/RT/Scrips.pm:290)
[52014] [Mon Mar 21 04:55:19 2022] [debug]: Found 0 scrips for TransactionBatch stage with applicable type(s) Set,SetWatcher for txn #191086 on ticket #20504 (/opt/rt5/sbin/…/lib/RT/Scrips.pm:477)
[52014] [Mon Mar 21 04:55:19 2022] [debug]: RT::Date used Time::ParseDate to make ‘2022-02-23 12:00:00’ 1645588800 (/opt/rt5/sbin/…/lib/RT/Date.pm:274)
[52014] [Mon Mar 21 04:55:19 2022] [debug]: RT::Date used Time::ParseDate to make ‘2022-02-23 10:00:00’ 1645581600 (/opt/rt5/sbin/…/lib/RT/Date.pm:274)
[52014] [Mon Mar 21 04:55:21 2022] [debug]: Rendering attachment #68320 of ‘text/html’ type (/opt/rt5/share/html/Elements/ShowTransactionAttachments:208)

Thank you.

Is taken a status in your lifecycle?

Thanks for your response.
No, It doesn’t execute my if statement. [if ($self->TransactionObj->Type eq ‘Take’ ) ]

it cant set a status of “taken” if taken isnt part of the ticket lifecycle

My lifecycle already defined, new<–>open, open<–>taken, new <–>Taken, etc.
The problem is $self->TransactionObj->Type always return ‘Set’. That’s why never execute my $self->TicketObj->SetStatus(‘taken’);

thanks.

What action are you performing to test this? Changing the owner of the ticket?

Let me further explain what i am doing.
First, the new ticket created by someone, the owner is Nobody.
Now, i login to my account and i would like to take this ticket. So i perform the action ‘Take’ to assign the ticket to myself.
The ticket Owner changed from Nobody to ‘myusername’ once i clicked the take action. But Status still remain the ‘New’ because of the script doesn’t execute $self->TicketObj->SetStatus(‘taken’);
I expected the script $self->TransactionObj->Type should return ‘Take’ so that the status will be set to ‘taken’.
Thanks.

Oh wait duh, the action type is Set but the Field for the transaction is something like “owner” I believe. But also since your condition is on owner change, you shouldn’t even need the check in your action since it’s checked in the condition

In my case everyone who have the privilege to change the owner. So that i need to extra checking for the action ‘take’. thanks.

My case is similar like the following case
Change ticket status from New to Open on Take action

And i referring to this documentation Transaction - Request Tracker Wiki

i expecting the script $self->TransactionObj->Type eq ‘Take’.
But i’m getting ‘Set’ currently. Anyone can advice and help? thank you.

In the example they check Type and Field:

($self->TransactionObj->Type eq "Set" && $self->TransactionObj->Field eq "Queue"));

You want to do the same, except for “Set” and “Owner”