The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
<%ARGS>
$TicketObj => undef
$Fields => undef
</%ARGS>
<%INIT>
my %as_string = RT->Config->Get('PriorityAsStringQueues');

# Leave it as-is if all queues use PriorityAsString; the overridden
# /Elements/SelectPriority catches this case and always shows the
# drop-down
return unless keys %as_string;

# Only applies if the ticket is in a PriorityAsString queue
return unless $TicketObj and $as_string{$TicketObj->QueueObj->Name};

# Swap out the /Elements/SelectPriority for /Elements/SelectPriorityAsString
for my $field (@{ $Fields }) {
    next unless ($field->{comp}||'') eq "/Elements/SelectPriority";
    $field->{comp} = "/Elements/SelectPriorityAsString";
    $field->{args}{Mapping} = $as_string{$TicketObj->QueueObj->Name};
}
</%INIT>