CommandbyMail - CustomFields - Can't get $queue->TicketCustomFields;

So i’ve done some debug in TakeAction.pm and it seems that
custom_fields is empty because I never see the ACTIONCF2 log

any leads at to debugging $queue->TicketCustomFields; ?

Canonicalize custom fields

    my $custom_fields = $queue->TicketCustomFields;
    $RT::Logger->info( "ACTIONCF1-> @{[ %{$queue} ]} " );
    while ( my $cf = $custom_fields->Next ) {
        $RT::Logger->info( "ACTIONCF2-> @{[ %{$cf} ]} " );
        my %tmp = _ParseAdditiveCommand( \%cmds, 0, "CustomField{".

$cf->Name ."}" );
next unless keys %tmp;
$create_args{ ‘CustomField-’ . $cf->id } = [
_CompileAdditiveForCreate(%tmp) ];
$RT::Logger->info( "ACTIONCREATED_ARGS-> " );
}

So I never enter this while loop. If I run a script outside of RT it works

my $custom_fields = $queue->TicketCustomFields;
while ( my $cf = $custom_fields->Next ) {
$RT::Logger->error( “HORRAY” );
my %tmp = _ParseAdditiveCommand( %cmds, 0, “CustomField{”.
$cf->Name ."}" );
next unless keys %tmp;
$create_args{ ‘CustomField-’ . $cf->id } = [
_CompileAdditiveForCreate(%tmp) ];
}

perl script that works using same user

use RT;
use RT::Queues;
use RT::Queue;
use RT::Interface::CLI qw(CleanEnv GetCurrentUser);
use RT::Tickets;
use Data::Dumper;

RT::LoadConfig();
RT::Init();
my $current_user = GetCurrentUser(‘user’ );

#print Dumper $current_user;
my $queue = new RT::Queue($current_user);
my $queue_id = 15;
$queue->Load($queue_id);
my $custom_fields = $queue->TicketCustomFields;
#print Dumper $custom_fields;

while ( my $cf = $custom_fields->Next ) {
print Dumper $cf;
}

So I never enter this while loop. If I run a script outside of RT it works

How do you know it is the same current user?
Compare $queue->CurrentUser->UserObj->Id to be sure

Generally this fails when a user doesn’t have SeeQueue

-kevin