You need to sign in to do that
Don't have an account?
PSahu
fetch lead city and pass to my custom controller method on page load of lead record
hello ,
Please check my snopshot for more description http://awesomescreenshot.com/070543dx79 i want to fetch lead city name and pass to my custom controller method on page load of lead record i.e if lead city name is mumbai then my visual force page which is located in left sidebar also show mumbai.
Thanks in advance
Please check my snopshot for more description http://awesomescreenshot.com/070543dx79 i want to fetch lead city name and pass to my custom controller method on page load of lead record i.e if lead city name is mumbai then my visual force page which is located in left sidebar also show mumbai.
Thanks in advance
If you are on the lead detail page record then you can simply fetch the URL in the browser address bar , it would be of format
https://cs12.salesforce.com/00Q0000002nvq13
From the URL you can get lead id and can query the city field from the lead record in your custom controller method.
Thanks
1. First I have created wrapperclass with Lead and Boolean
//public class LeadData {
public lead mylead {set;get;}
public boolean active {set;get;}
} //
and written logic and methods as below
public class LeadWrapperclass {
public list<LeadData> leads {set;get;}
public list<lead> ListLeads {set;get;}
public boolean flag1 {set;get;}
public boolean flag2 {set;get;}
public LeadWrapperclass(){
list<lead> mylist=[select LastName,FirstName,Phone,Email,Company,rating from lead];
leads= new list<LeadData> ();
ListLeads= new list<lead>();
for(lead l:mylist){
LeadData ld=new LeadData();
ld.mylead=l;
ld.active=false;
leads.add(ld);
}
}
public void create(){
list<lead> mylist=new list<lead>();
for(LeadData ld:leads){
if(ld.active==true){
lead l=ld.mylead;
l.rating='Hot';
mylist.add(l);
}
}
update mylist;
}
public void leadsrec( ){
leads.clear ();
for(LeadData ld:leads){
lead l=ld.mylead;
if(l.rating=='Hot'){
leads.add(ld);
}
}
}
}
corresponding Visual force page
<apex:page controller="LeadWrapperclass">
<apex:form >
<apex:pageBlock >
<apex:pageBlockButtons location="top">
<apex:commandButton value="update" action="{!create}" reRender="one"/>
<apex:commandButton value="filter" action="{!leadsrec}" reRender="two"/>
</apex:pageBlockButtons>
</apex:pageBlock>
<apex:pageBlock title="Leads" >
<apex:pageBlockTable value="{!leads}" var="l" id="one" >
<apex:column >
<apex:facet name="header">
<apex:inputCheckbox />
</apex:facet>
<apex:inputCheckbox value="{!l.active}" />
</apex:column>
<apex:column value="{!l.mylead.firstName}"/>
<apex:column value="{!l.mylead.phone}"/>
<apex:column value="{!l.mylead.email}"/>
<apex:column value="{!l.mylead.company}"/>
<apex:column value="{!l.mylead.rating}"/>
</apex:pageBlockTable>
</apex:pageBlock>
<apex:pageBlock title="Show Leads Rating is Hot" id="two">
<apex:pageBlockTable value="{!ListLeads}" var="l">
<apex:column value="{!l.firstName}"/>
<apex:column value="{!l.phone}"/>
<apex:column value="{!l.email}"/>
<apex:column value="{!l.company}"/>
<apex:column value="{!l.rating}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>