[rt-users] I just can't figure out how to get the values from my custom fields!
Brian Kjelin Olsen
BKO at schilling.dk
Sun Mar 4 04:25:47 EST 2007
Hi everyone
I just can't figure how to get the values of custom fields on ticket transactions from scrip.
As an example I have made this small scrip where I print the field names and then try to get the values from those fields.
--- Scrip example ---
my $k=""; my $v="";
$RT::Logger->debug("Get names of transaction Custom fields from the ticket object");
if (my $TCFs = $self->TicketObj->TransactionCustomFields()) {
while (my $CF = $TCFs->Next()) {
$RT::Logger->debug("Get values from transaction custom field '" . $CF->Name . "' from the transaction object");
my %values = $self->TransactionObj->CustomFieldValues($CF->Name);
while (($k,$v) = each %values) {
$RT::Logger->debug("$k => $v");
}
$RT::Logger->debug("End of getting values from transaction custom field '" . $CF->Name . "' from the transaction object");
}
}
$RT::Logger->debug("End of getting names of transaction Custom fields from the ticket object");
---------------------
As a result (See log below) I seems to get two value hashes, but without any values?!?!
(And - "Yes: I do remember to add some values to the two fields while making the test transaction" :-)
PS This is my first Perl and RT programming, so I guess that this could be the reason :-)
----- Log file ------
[Sat Mar 3 20:24:08 2007] [debug]: Get names of transaction Custom fields from the ticket object ((eval 429):16)
[Sat Mar 3 20:24:08 2007] [debug]: Get values from transaction custom field 'Service type' from the transaction object ((eval 429):19)
[Sat Mar 3 20:24:08 2007] [debug]: RT::ObjectCustomFieldValues=HASH(0xac022b4) => ((eval 429):22)
[Sat Mar 3 20:24:08 2007] [debug]: End of getting values from transaction custom field 'Service type' from the transaction object ((eval 429):24)
[Sat Mar 3 20:24:08 2007] [debug]: Get values from transaction custom field 'Service text' from the transaction object ((eval 429):19)
[Sat Mar 3 20:24:08 2007] [debug]: RT::ObjectCustomFieldValues=HASH(0x9aa45f4) => ((eval 429):22)
[Sat Mar 3 20:24:08 2007] [debug]: End of getting values from transaction custom field 'Service text' from the transaction object ((eval 429):24)
[Sat Mar 3 20:24:08 2007] [debug]: End of getting names of transaction Custom fields from the ticket object ((eval 429):27)
---------------------
Med venlig hilsen / Best regards
Brian Kjelin Olsen
Systemkonsulent
Schilling A/S
Baldersbækvej 24-26
DK-2635 Ishøj
Tel: +45 70 27 99 00
Fax: +45 70 27 99 10
bko at schilling.dk
www.schilling.dk
More information about the rt-users
mailing list