[rt-users] getting ticket's custom field values from within scrip?!

Ruslan U. Zakirov Ruslan.Zakirov at acronis.com
Mon Oct 4 12:39:37 EDT 2004


May be you can share relevant output from '/tmp/scrip.test';

hubert lubaczewski wrote:
> hi
> i'm getting kind of desperate.
> i tried nearly everything, yet i can't succed.
> i'm using rt 3.0.6, and my final scrip action looks like:
> 
> -- action
> open(OUT, ">", "/tmp/scrip.test");
> <snipped irrelevant lines>
> my @a = $self->TicketObj->FirstCustomFieldValue('worktime-a');
FirstCustomFieldValue return scalar

> require Data::Dumper;
> print OUT "7: " . Data::Dumper::Dumper(\@a);
> 
> my $cfx = new RT::CustomField( $self->TransactionObj->CreatorObj );
> print OUT "8: $cfx\n";
> ($id,$msg) = $cf->LoadByNameAndQueue ('Name'=>'worktime-a', 'Queue' => $self->TicketObj->QueueObj->Id);
I don't remeber when it was fixed(somwhere arounf 3.0.7-10), but this 
can be broken if 'worktime-a' is global field.


> print OUT "9: $id | $msg\n";
> if (! $id) {
> 	($id,$msg) = $cf->LoadByNameAndQueue ('Name'=>'worktime-a', 'Queue' => 0);
> 	print OUT "9a: $id | $msg\n";
> }
> unless ($id) {
> 	close OUT;
> 	return 1;
> }
> my $x = $self->TicketObj->FirstCustomFieldValue($cfx->id);
> require Data::Dumper;
> print OUT "10: [$x]\n";
> my $CustomFieldValues=$self->TicketObj->CustomFieldValues('worktime-a');
> my @x;
> while (my $CustomFieldValue = $CustomFieldValues->Next) {
> 	push @x, $CustomFieldValue->Content;
> }
> print OUT "11: [".join(", ", @x).".\n";
> close OUT;
> return 1;
> 
> -- action
> 
> basically, despite the fact that i have set worktime-a for this ticket
> to 123, all i got is undef.
> can anybody of you point me to *working* way of getting ticket's custom
> field value?
should be all. I don't see more errors.

> 
> best regards
> 
> depesz
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
> 
> Be sure to check out the RT wiki at http://wiki.bestpractical.com




More information about the rt-users mailing list