+ Start a Discussion
Marcelo AgostinhoMarcelo Agostinho 

Getting Value from Lookup


Im here to know my code don't  get value from my VF Page.
My VF Page.
<apex:page controller="CarteiraCliente" action="{!teste}" sidebar="false" contentType="{!contentType}">
    <apex:pageBlock rendered="{!showFilter}" >
        <apex:form >
                Vendedor &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <apex:inputField id="vendedor" value="{!filtro.Vendedor__c}" required="false" />
            <p> Supervisor &nbsp;&nbsp;&nbsp;&nbsp;
                <apex:inputField id="supervisor" value="{!filtro.Vendedor__r.Supervisao_Vendedor__c}" required="false"/>
            <apex:commandButton value="Filtrar" action="{!teste}" reRender="carteiraCliente" />
    <apex:pageBlock id="carteiraCliente" title="{!title}">
        <apex:pageBlockTable value="{!valoresClienteMes}" var="cliente" title="Carteira de Cliente">
            <apex:column headerValue="Vendedor" id="nomeVendedor" value="{!cliente.nomeVendedor}" />
            <apex:column headerValue="Nome" id="nomeCliente" value="{!cliente.nomeCliente}" />
            <apex:column headerValue="valorTreze" id="valorTreze"  value="{!cliente.valorTreze}" />



My Controller



public class CarteiraCliente {
    public MovimentoMes__c filtro { get; set; }

    public CarteiraCliente() {
        filtro = new MovimentoMes__c();
        showFilter = false;
    public aMethod(){
        String paramVendedor = filtro.Vendedor__c;
        System.Debug ('=====' +paramVendedor+ '====='); 
        String paramSupervisor = filtro.Vendedor__r.Supervisao_Vendedor__c;
        System.Debug ('=====' +paramSupervisor+ '=====');


 On my VF Page, when i get a value from lookup icon and click to go... i get the value on my Apex Class...

     but on my second field i alwas get null.... 

 What's happening? And what i can do to solve it?

Tks again for everything




Can you tell me that in Vendedor__r.Supervisao_Vendedor__c , Supervisao_Vendedor__c field is lookup field or normal field?


Tryout the standardcontroller="MovimentoMes__c" and use extension="CarteiraCliente" and let me know if you still have any issue.

Marcelo AgostinhoMarcelo Agostinho

Very tks for your reply!


But i solved it with another way...


I just initialized my Vendedor_r inside my Constructor

Here is my constructor:




 public CarteiraCliente() {
        filtro = new MovimentoMes__c();
        filtro.Vendedor__r = new Vendedor__c();
        showFilter = false;


 So now i have a reference to Vendedor_r inside my filtro attribute.