Hi,<br><br>Anyone have an idea?<br><br>JMC<br><br><div class="gmail_quote">2012/8/24 DupondEt Dupont <span dir="ltr"><<a href="mailto:jean.mich.c@gmail.com" target="_blank">jean.mich.c@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Hi all,<br><br>i recently install lastest RT 4 release and start setting up external custom fields from an Oracle query. (as describe in docs/extending/external_custom_fields.pod)<br><br>Everything work really fine, until i decided to use previously filled custom fied as argument in an other external custom field search.<br>


<br>In this study case ;) , both custom fields are assigned to ticket.<br>The first external CF (name Client) retrieve customer list and CF store the value I have select.<br>The second external CF (name Machine) should retrieve hostname for the customer select in CF Client...<br>


<br>Here is the piece of PERL code for CF Machine<br>(/opt/rt4/lib/RT/CustomFieldValues/Test2.pm)<br>-----------------------------------------------------------------------------<br>package RT::CustomFieldValues::Test2;<br>


<br>use strict;<br>use warnings;<br>use DBI;<br>use DBD::Oracle;<br>use base qw(RT::CustomFieldValues::External);<br><br>sub SourceDescription {<br>    return 'test2';<br>}<br><br>sub ExternalValues {<br>        my $self = shift;<br>


# the previsous custom field name<br>        my $CFName = 'Client';<br># should store the name of my customer...<br>        my $CFClient = $self->TicketObj->FirstCustomFieldValue($CFName);<br>        my $i = 0;<br>


        my @res;<br>        my $Hostname<br>        my $dbh = DBI->connect("dbi:Oracle:host=XXX.XXX.XXX.XXX;sid=XX;port=XXXX","XXXX","XXXX", {ora_session_mode => 0, PrintError =>0});<br>


        my $req = "SELECT distinct HOSTNAME FROM my_table where CLIENT='$CFClient'";<br>        my $hreq = $dbh->prepare($req);<br>        $hreq->execute();;<br>        $hreq->bind_columns(\$Hostname);<br>


        while ($hreq->fetch()){<br>                push @res, {<br>                    name        => $Hostname,<br>                    description => $Hostname,<br>                    sortorder   => $i++,<br>


                };<br>        }<br>        return \@res;<br>}<br>-----------------------------------------------------------------------------<br clear="all"><br>I used $self->TicketObj->FirstCustomFieldValue($CFName) but it's not know in this context apparently as Data::Dumper shows me...(but $self->CurrentUser is)<br>


<br>I hope you'll have a solution to deal with this, cause i got no more ideas.<br><br>Thank you in advance for your time.<br><br>JMC<br>
</blockquote></div>