[rt-users] I just can't figure out how to get the values from mycustom fields!

Brian Kjelin Olsen BKO at schilling.dk
Mon Mar 5 03:08:29 EST 2007


Please - Any clues?
It would be most appreciated.

Med venlig hilsen / Best regards
Brian Kjelin Olsen
Schilling A/S
-----Oprindelig meddelelse-----
Fra: rt-users-bounces at lists.bestpractical.com [mailto:rt-users-bounces at lists.bestpractical.com] På vegne af Brian Kjelin Olsen
Sendt: 4. marts 2007 10:26
Til: rt-users at lists.bestpractical.com
Emne: [rt-users] I just can't figure out how to get the values from mycustom fields!

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

_______________________________________________
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sales at bestpractical.com


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



More information about the rt-users mailing list