SV: I just can't figure out how to get the values from mycustom fields!

Hi Kenneth

It is actually from ticket transaction were I’m trying to get values
from custom fields.
I’m surprised that the values in custom fields actually only exist in a
short time, but nevertheless I only need the values in a short time. I’m
using them to feed an external ERP system with activity ID and a short
message if the user records a value into the “work time” field during
the transaction.

Med venlig hilsen / Best regards
Brian Kjelin Olsen
Schilling A/S

-----Oprindelig meddelelse-----Fra: Kenneth Crocker [mailto:KFCrocker@lbl.gov]
Sendt: 5. marts 2007 19:00
Til: Brian Kjelin Olsen
Cc: rt-users@lists.bestpractical.com
Emne: Re: [rt-users] I just can’t figure out how to get the values from
mycustom fields!

Brian,

Are you trying to get values from existing ticket custom fields?

Ticket
transaction custom fields are different from ticket custom fields. If
you are trying to get values from existing tickets, then the transaction

custom fields may very well have no values any longer.

Kenn
LBNL

Thank you, Joe, for your answer.

That is correct and yet not, I’m afraid.
You are showing a way to check the custom fields on tickets, but I need
to get values from custom fields on ticket-transactions.

However it got me to recheck that I actually had defined the fields as
global.
In the example I had written I could actually print out the field names
from the object but not the values. The fields are there - global or not
:slight_smile:

  • Brian

-----Oprindelig meddelelse-----Fra: Joe Casadonte [mailto:joe.casadonte@oracle.com]
Sendt: 5. marts 2007 16:10
Til: Brian Kjelin Olsen
Cc: rt-users@lists.bestpractical.com
Emne: Re: [rt-users] I just can’t figure out how to get the values from
mycustom fields!

Hi Steve

I did try your code example with enthusiasm but still there weren’t any
values.
I did notice 2 odd things (well… odd to me at least).

  1. The scrip is executed in the same moment when the user press comment,
    reply, etc. This is just before the ticket transaction custom fields are
    presented and that is for sure a reason why I never get any values! I
    really wonder why the scrip is executed (before?) the transaction?!? I
    mean

  2. The scrip part “Custom action cleanup code” wasn’t executed. I can’t
    figure out why, but suddenly it did execute that action part again. I’m
    sure that I must have done something wrong - but shouldn’t it only be
    from the condition part you can control whether to execute both action
    parts or not? It really doesn’t matter too much to me. It just seems
    odd, and odd was what I was looking for.

It seems that is was “still close but no cigar” :slight_smile:
Thanks anyway!

  • Brian

-----Oprindelig meddelelse-----Fra: Stephen Turner [mailto:sturner@MIT.EDU]
Sendt: 5. marts 2007 19:34
Til: Brian Kjelin Olsen; rt-users@lists.bestpractical.com
Emne: Re:[rt-users] I just can’t figure out how to get the values from
mycustom fields!


It looks like you’re pretty close -

$self->TransactionObj->CustomFieldValues($CF->Name)
will give you an ObjectCustomFieldValues
collection object - each member of the collection
is an ObjectCustomFieldValue object. You can
iterate over the collection and see the values something like this:

my $values = $self->TransactionObj->CustomFieldValues($CF->Name);
while (my $CFV = $values->Next() ) {
$RT::Logger->debug($CFV->Content);
}

Steve

Brian,

Are the CF's in a ticket? If so, you could use that info.

Kenn
LBNL

Brian Kjelin Olsen wrote: