You need to sign in to do that
Don't have an account?
Marcelo Agostinho
Getting Value from Lookup
Hello!
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 > <p> Vendedor <apex:inputField id="vendedor" value="{!filtro.Vendedor__c}" required="false" /> </p> <p> Supervisor <apex:inputField id="supervisor" value="{!filtro.Vendedor__r.Supervisao_Vendedor__c}" required="false"/> </p> <apex:commandButton value="Filtrar" action="{!teste}" reRender="carteiraCliente" /> </apex:form> </apex:pageBlock> <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}" /> </apex:pageBlockTable> </apex:pageBlock> </apex:page>
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.
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:
So now i have a reference to Vendedor_r inside my filtro attribute.
Tks!