function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
soasoa 

Force.com Zillow Mashup using VisualForce

Hi ,

I am trying to invoke a REST  web service through Force.com (Visual Force) as mentioned in the example provided in :

http://wiki.apexdevnet.com/index.php/Force.com_Zillow_Mashup

The code for the page editor is as follows:

Code:
<apex:page standardController="Lead" extensions="ZillowLeadExtension">
    <apex:form >  
    <!-- Insert new Lead -->
    <apex:pageBlock title="New Lead" >        
        <apex:pageBlockButtons location="top">                                  
           <apex:commandButton action="{!save}" value="Save" id="saveLead" />       
        </apex:pageBlockButtons>
       <apex:pageBlockSection title="Lead Data" columns="1"> 
          <apex:inputField value="{!aLead.LastName}" />
          <apex:inputField value="{!aLead.FirstName}" />
          <apex:inputField value="{!aLead.Company}" />                                       
          <apex:inputField value="{!aLead.Phone}" />
          <apex:inputField value="{!aLead.Email}" />
          <apex:inputField value="{!aLead.Street}" />
          <apex:inputField value="{!aLead.City}" />
          <apex:inputField value="{!aLead.State}" />
          <apex:inputField value="{!aLead.PostalCode}" />
      </apex:pageBlockSection>
   </apex:pageBlock>
  </apex:form>
 </apex:page>


 
the code for the class ZillowLeadExtension is :

Code:
public class ZillowLeadExtension {
 public Lead aLead ;
 public ZillowLeadExtension(ApexPages.StandardController controller) {
  aLead = new Lead() ;      
 }

public PageReference save() {        
 PageReference pr ;
 try{
  ZillowService p = new ZillowService() ;
  // make the web service call out
  ZillowTypes.PropertySearchResponse r = p.searchZillow( aLead.Street, aLead.City, aLead.State) ;
  // store in custom field
  aLead.Home_Value__c = r.getZEstimateAmount() ;
  // insert new record into DB
  insert aLead ;
  // redirect to the newly inserted lead
  pr = new PageReference( '/' + aLead.id );
 }
  catch( ZillowTypes.ZillowException e){
  System.debug( '**** Caught Exception' +e ) ;
}
 return pr ;
}
}


 
I have included all the other classes on which ZillowLeadExtension depends.When I try to save the Code written in the page editor , I am getting the following error:

 

ErrorError: Unknown property 'LeadStandardController.aLead'
 
Why is it not taking the ZillowLeadExtension class?
is there any other way to include the class??
 
Please Help..
 
 
Regards,
Diti
<SCRIPT type=text/javascript>// var tabId = getCookie('dmTab'); var closeButtonId = 'thePage:theForm:closeButton'; if (tabId && getBottomPanelHeight() > 28) { showCloseButton(closeButtonId, true); } else { showCloseButton(closeButtonId, false); } document.getElementById('thePage:theForm:showControllerLink').style.display = (false) ? 'inline' : 'none'; // </SCRIPT>
Sam.arjSam.arj

This may help you:

Your aLead is a public field not a property define it this way:

Code:
public Lead aLead
{
   get;
   set;
}

 The reason is you are using aLead as a Controller property on your visualforce page.


hankreardenhankrearden
I'm trying to take the same tutorial and extend to an edit/update use-case. 

I have a button for GetZestimate that calls a VF page "Update Lead"
Code:
<apex:page standardController="Lead" extensions="ZillowLeadUpdate">
    <apex:form >  
    
    <!-- Review Lead Data to Update -->
    <apex:pageBlock title="Hello {!$User.FirstName}. Save the lead to run the Zestimate.  You look nice today." >        
        <apex:pageBlockButtons location="top">                                  
           <apex:commandButton action="{!save}" value="Save" id="saveLead" />       
        </apex:pageBlockButtons>
       <apex:pageBlockSection title="Lead Data" columns="1"> 
          <apex:inputField value="{!Lead.LastName}" />
          <apex:inputField value="{!Lead.FirstName}" />
          <apex:inputField value="{!Lead.Company}" />                                       
          <apex:inputField value="{!Lead.Phone}" />
          <apex:inputField value="{!Lead.Email}" />
          <apex:inputField value="{!Lead.Street}" />
          <apex:inputField value="{!Lead.City}" />
          <apex:inputField value="{!Lead.State}" />
          <apex:inputField value="{!Lead.PostalCode}" />
      </apex:pageBlockSection>
   </apex:pageBlock>
  </apex:form>
 </apex:page>

 The related ZillowLeadUpdate page is a mess.  From the tutorial, the VF page called "aLead" for all the input fields.  I've made every change that I could in the ZillowLeadUpdate extension...I'm back to essentially the version that I started with:
Code:
public class ZillowLeadUpdate {
    public ZillowLeadUpdate(ApexPages.StandardController controller) {
   aLead = new Lead() ;
      
    }


    public Lead aLead ;
    public Lead getALead(){
        // if( aLead == null ) aLead = new Lead() ;    
        return aLead ;
    }
 
 
    public PageReference save() {
        
        PageReference pr ;
        try{
   ZillowService p = new ZillowService() ;
   ZillowTypes.PropertySearchResponse r = p.searchZillow( aLead.Street, aLead.City, aLead.State) ;
   aLead.Home_Value__c = r.getZEstimateAmount() ;
   insert aLead ;
   pr = new PageReference( '/' + aLead.id );
  }
  catch( ZillowTypes.ZillowException e){
   System.debug( '**** Caught Exception' +e ) ;
  }
        return pr ;
    }
}

 
Is my issue in the aLead definitions in the extension or do I just need to define something differently in my VF page?

Thank you.

hankreardenhankrearden
Excuse me.  The VF Page is called "UpdateLead" the controller is "ZillowLeadUpdate"