At Monday 3/5/2007 03:08 AM, Brian Kjelin Olsen wrote:
Please - Any clues?
It would be most appreciated.

Med venlig hilsen / Best regards
Brian Kjelin Olsen
Schilling A/S
-----Oprindelig meddelelse-----
Fra: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] På vegne af Brian Kjelin Olsen
Sendt: 4. marts 2007 10:26
Til: rt-users@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");
---------------------


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

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

Community help: http://wiki.bestpractical.com
Commercial support: [EMAIL PROTECTED]


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

Reply via email to