i am trying to add one button in lead detail page layout.on clicking on this button i want show a visual force page showing custom object details.my custom object is tractor__c.so far i am trying this code
<apex:page docType="html-5.0" standardController="Lead" extensions="LeadTractorExtension">
<style>
</style>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<div class="row">
<div class="col-sm-12">
<div class="form-group">
<h3>Search for Tractor</h3>
</div>
<div class="col-sm-12 form-group">
<apex:form >
<apex:pageBlock >
<div class="col-sm-3">
<label>Tractor Make</label>
<apex:inputField value="{!tractor .Manufacturer__c}"/>
</div>
<div class="col-sm-3">
<label>Tractor Model</label>
<apex:inputField value="{!tractor.Model_Name__c }"/>
</div>
<div class="col-sm-3">
<label>Deck Size</label>
<apex:inputField value="{!tractor.Deck__c }"/>
</div>
<div class="col-sm-3">
<label>Rake Model</label>
<apex:inputField value="{!tractor.Rake_Model__c }"/>
</div>
</apex:pageBlock>
</apex:form>
</div>
<div class="row">
<div class="col-sm-offset-4 ">
<button>Check For Availebility</button>
</div>
</div>
</div>
</div>
and for my extension class is like
public class LeadTractorExtension {
public Tractor__c tractor{get;set;}
public LeadTractorExtension(ApexPages.StandardController stdController) {
this.tractor = (Tractor__c)stdController.getRecord();
getTractorDetails();
}
public Tractor__c getTractorDetails(){
return tractor;
}
} i am getting error like Invalid conversion from runtime type Lead to Tractor__c .if i change standard controller name to tractor__c .page will work .but this page wont list in lead page layout.In Lead object TractorInfo__c is the lookup field.can any one help to solve this issue