How to get Stage of scrips on queue

Hi, I haven’t been able to easily get the Stage of the scrip listed from a Queue.

$objScrips->LimitToQueue($QueueId);
my $s = $objScrips->Next;
print $s->Stage; #does not work, it needs a TicketObj
# Can't call method "Queue" on an undefined value

Finding a ticket in queue is not much convenient. What I am missing?

It seems like that method should accept a queue object or a ticket object but looking at the code it only expects a ticket. You can take the logic from the method and do something like this?

$objScrips->LimitToQueue($QueueId);
my $s = $objScrips->Next;

my $rec = RT::ObjectScrip->new( $self->CurrentUser );
$rec->LoadByCols( Scrip => $s->id, ObjectId => $QueueId );
my $stage = $rec->Stage if $rec->id;

Yes, that’s it. Why I didn’t get it by myself? :slight_smile:
Thank you!

1 Like