Re: [rt-users] External Custom Field query based an other Custom Field value
Hi Ruslan, i see exactly what to do. I'll try to do this on a 3 levels CF depency. Do you know if the feature a want use should be in a future release? Thank you for your time. JMC 2012/8/27 Ruslan Zakirov > Hi, > > At this moment it's impossible to do like you want it to do. External > custom fields should return all possible values. > > You should configure one CF to be based on other in the UI and in your > code for that CF return Category. Category should be a value of first CF. > > Hope you don't have thousands of machines. > > Ruslan from phone. > 27.08.2012 16:31 пользователь "DupondEt Dupont" > написал: > > Hi, >> >> Anyone have an idea? >> >> JMC >> >> 2012/8/24 DupondEt Dupont >> >>> Hi all, >>> >>> 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) >>> >>> Everything work really fine, until i decided to use previously filled >>> custom fied as argument in an other external custom field search. >>> >>> In this study case ;) , both custom fields are assigned to ticket. >>> The first external CF (name Client) retrieve customer list and CF store >>> the value I have select. >>> The second external CF (name Machine) should retrieve hostname for the >>> customer select in CF Client... >>> >>> Here is the piece of PERL code for CF Machine >>> (/opt/rt4/lib/RT/CustomFieldValues/Test2.pm) >>> >>> - >>> package RT::CustomFieldValues::Test2; >>> >>> use strict; >>> use warnings; >>> use DBI; >>> use DBD::Oracle; >>> use base qw(RT::CustomFieldValues::External); >>> >>> sub SourceDescription { >>> return 'test2'; >>> } >>> >>> sub ExternalValues { >>> my $self = shift; >>> # the previsous custom field name >>> my $CFName = 'Client'; >>> # should store the name of my customer... >>> my $CFClient = $self->TicketObj->FirstCustomFieldValue($CFName); >>> my $i = 0; >>> my @res; >>> my $Hostname >>> my $dbh = >>> DBI->connect("dbi:Oracle:host=XXX.XXX.XXX.XXX;sid=XX;port=","","", >>> {ora_session_mode => 0, PrintError =>0}); >>> my $req = "SELECT distinct HOSTNAME FROM my_table where >>> CLIENT='$CFClient'"; >>> my $hreq = $dbh->prepare($req); >>> $hreq->execute();; >>> $hreq->bind_columns(\$Hostname); >>> while ($hreq->fetch()){ >>> push @res, { >>> name=> $Hostname, >>> description => $Hostname, >>> sortorder => $i++, >>> }; >>> } >>> return \@res; >>> } >>> >>> - >>> >>> I used $self->TicketObj->FirstCustomFieldValue($CFName) but it's not >>> know in this context apparently as Data::Dumper shows me...(but >>> $self->CurrentUser is) >>> >>> I hope you'll have a solution to deal with this, cause i got no more >>> ideas. >>> >>> Thank you in advance for your time. >>> >>> JMC >>> >> -- Jean-Michel Collongette jean.mic...@gmail.com
Re: [rt-users] External Custom Field query based an other Custom Field value
Hi, At this moment it's impossible to do like you want it to do. External custom fields should return all possible values. You should configure one CF to be based on other in the UI and in your code for that CF return Category. Category should be a value of first CF. Hope you don't have thousands of machines. Ruslan from phone. 27.08.2012 16:31 пользователь "DupondEt Dupont" написал: > Hi, > > Anyone have an idea? > > JMC > > 2012/8/24 DupondEt Dupont > >> Hi all, >> >> 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) >> >> Everything work really fine, until i decided to use previously filled >> custom fied as argument in an other external custom field search. >> >> In this study case ;) , both custom fields are assigned to ticket. >> The first external CF (name Client) retrieve customer list and CF store >> the value I have select. >> The second external CF (name Machine) should retrieve hostname for the >> customer select in CF Client... >> >> Here is the piece of PERL code for CF Machine >> (/opt/rt4/lib/RT/CustomFieldValues/Test2.pm) >> >> - >> package RT::CustomFieldValues::Test2; >> >> use strict; >> use warnings; >> use DBI; >> use DBD::Oracle; >> use base qw(RT::CustomFieldValues::External); >> >> sub SourceDescription { >> return 'test2'; >> } >> >> sub ExternalValues { >> my $self = shift; >> # the previsous custom field name >> my $CFName = 'Client'; >> # should store the name of my customer... >> my $CFClient = $self->TicketObj->FirstCustomFieldValue($CFName); >> my $i = 0; >> my @res; >> my $Hostname >> my $dbh = >> DBI->connect("dbi:Oracle:host=XXX.XXX.XXX.XXX;sid=XX;port=","","", >> {ora_session_mode => 0, PrintError =>0}); >> my $req = "SELECT distinct HOSTNAME FROM my_table where >> CLIENT='$CFClient'"; >> my $hreq = $dbh->prepare($req); >> $hreq->execute();; >> $hreq->bind_columns(\$Hostname); >> while ($hreq->fetch()){ >> push @res, { >> name=> $Hostname, >> description => $Hostname, >> sortorder => $i++, >> }; >> } >> return \@res; >> } >> >> - >> >> I used $self->TicketObj->FirstCustomFieldValue($CFName) but it's not know >> in this context apparently as Data::Dumper shows me...(but >> $self->CurrentUser is) >> >> I hope you'll have a solution to deal with this, cause i got no more >> ideas. >> >> Thank you in advance for your time. >> >> JMC >> >
Re: [rt-users] External Custom Field query based an other Custom Field value
Hi, Anyone have an idea? JMC 2012/8/24 DupondEt Dupont > Hi all, > > 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) > > Everything work really fine, until i decided to use previously filled > custom fied as argument in an other external custom field search. > > In this study case ;) , both custom fields are assigned to ticket. > The first external CF (name Client) retrieve customer list and CF store > the value I have select. > The second external CF (name Machine) should retrieve hostname for the > customer select in CF Client... > > Here is the piece of PERL code for CF Machine > (/opt/rt4/lib/RT/CustomFieldValues/Test2.pm) > > - > package RT::CustomFieldValues::Test2; > > use strict; > use warnings; > use DBI; > use DBD::Oracle; > use base qw(RT::CustomFieldValues::External); > > sub SourceDescription { > return 'test2'; > } > > sub ExternalValues { > my $self = shift; > # the previsous custom field name > my $CFName = 'Client'; > # should store the name of my customer... > my $CFClient = $self->TicketObj->FirstCustomFieldValue($CFName); > my $i = 0; > my @res; > my $Hostname > my $dbh = > DBI->connect("dbi:Oracle:host=XXX.XXX.XXX.XXX;sid=XX;port=","","", > {ora_session_mode => 0, PrintError =>0}); > my $req = "SELECT distinct HOSTNAME FROM my_table where > CLIENT='$CFClient'"; > my $hreq = $dbh->prepare($req); > $hreq->execute();; > $hreq->bind_columns(\$Hostname); > while ($hreq->fetch()){ > push @res, { > name=> $Hostname, > description => $Hostname, > sortorder => $i++, > }; > } > return \@res; > } > > - > > I used $self->TicketObj->FirstCustomFieldValue($CFName) but it's not know > in this context apparently as Data::Dumper shows me...(but > $self->CurrentUser is) > > I hope you'll have a solution to deal with this, cause i got no more ideas. > > Thank you in advance for your time. > > JMC >
[rt-users] External Custom Field query based an other Custom Field value
Hi all, 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) Everything work really fine, until i decided to use previously filled custom fied as argument in an other external custom field search. In this study case ;) , both custom fields are assigned to ticket. The first external CF (name Client) retrieve customer list and CF store the value I have select. The second external CF (name Machine) should retrieve hostname for the customer select in CF Client... Here is the piece of PERL code for CF Machine (/opt/rt4/lib/RT/CustomFieldValues/Test2.pm) - package RT::CustomFieldValues::Test2; use strict; use warnings; use DBI; use DBD::Oracle; use base qw(RT::CustomFieldValues::External); sub SourceDescription { return 'test2'; } sub ExternalValues { my $self = shift; # the previsous custom field name my $CFName = 'Client'; # should store the name of my customer... my $CFClient = $self->TicketObj->FirstCustomFieldValue($CFName); my $i = 0; my @res; my $Hostname my $dbh = DBI->connect("dbi:Oracle:host=XXX.XXX.XXX.XXX;sid=XX;port=","","", {ora_session_mode => 0, PrintError =>0}); my $req = "SELECT distinct HOSTNAME FROM my_table where CLIENT='$CFClient'"; my $hreq = $dbh->prepare($req); $hreq->execute();; $hreq->bind_columns(\$Hostname); while ($hreq->fetch()){ push @res, { name=> $Hostname, description => $Hostname, sortorder => $i++, }; } return \@res; } - I used $self->TicketObj->FirstCustomFieldValue($CFName) but it's not know in this context apparently as Data::Dumper shows me...(but $self->CurrentUser is) I hope you'll have a solution to deal with this, cause i got no more ideas. Thank you in advance for your time. JMC