Merging Custom Field Values

I’ve gotten a little ways here on defining a custom scrip that launches on
merge, not sure about if I can limit the queues like I’m doing though…
my $txn = $self->TransactionObj;
return undef unless $txn->Type =~ /^AddLink$/i;
return undef unless $txn->Field =~ /^MergedInto$/i;
my @queues = qw(Enrollment/Recruitment Installation Accounting
my $queue = $txn->Queue;
my $qCount = grep(/\Q$queue\E/,@queues);
my $cfv = $self->TicketObj->FirstCustomFieldValue(‘Lead Source’);
return undef if (length($cfv > 0));
return undef unless $qCount >= 1;
return 1;

My question is really when your merging two tickets, the
$self->TransactionObj is for which the ticket your merging from or the
ticket your merging into?
If so how do you get the other ticket in the transaction, so I can pull the
custom field values I need from it to set in the merged ticket, right now,
if you merge a ticket, into another, custom fields dont get merged. …

Thanks in advance,