On Thu, Jul 22, 2010 at 11:50:31PM -0400, anthony acquanita wrote:
>    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

>    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;
>    }

> 
> Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
> Buy a copy at http://rtbook.bestpractical.com

Attachment: pgpbwsoO3X8u5.pgp
Description: PGP signature

Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Reply via email to