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
Adriana VoyceAdriana Voyce 

Visualforce page to bring in Standard Lead creation page

We use ringlead internally to help maintain data integrity, and have over written the new button so that when new is clicked ringlead evaluates the record. 

The problem is that in our partner community the same button is used and the end user receives an error. The only way to prevent this from happening would be to create a new button that is assigned only to the partner profiles, which I can do, but I need it to call a VF page which would be the lead creation page. 

How can I recreate the lead creation page trought visual force so that partners can create leads. I am novice to developing so my knowledge is very limited and I cannot figure out the code... I need to do it for a coupoe other objects as well. 

Any help would be greatly appreciated... All I have written is

<apex:page standardcontroller="Lead" tabstyle="Lead"> <apex:form >
 
Prabhat Kumar12Prabhat Kumar12
Use this in your visualforce page. Don't forget mark as answer if it works for you. :)

<apex:page standardcontroller="Lead" tabstyle="Lead">
 
 <apex:form >
 
 <apex:sectionheader title="Lead Edit" subtitle="{!if(Lead.Id==null,'New Lead',Lead.Name)}"></apex:sectionheader>
 
 <apex:pageblock mode="edit" id="leadPB" title="Lead Edit">
 
 <apex:pageblockbuttons >
 <apex:commandbutton action="{!save}" value="Save"></apex:commandbutton>
 <!-- If you wish to implement Save & New functionality you will have to write an Apex Extension with your own Save & New Method -->
 <apex:commandbutton action="{!cancel}" value="Cancel"></apex:commandbutton>
 </apex:pageblockbuttons>
 
 <apex:pagemessages ></apex:pagemessages> <!-- displays all message generated by the component -->
 
 <apex:pageblocksection id="LeadInformationPBS" title="Lead Information">
 <!-- Make Owner field editable in system or else you won't be able to edit the Owner -->
 <apex:inputfield value="{!Lead.OwnerId}"></apex:inputfield>
 <apex:inputfield value="{!Lead.Phone}"></apex:inputfield>
 
 <!-- Since we need to group two input fields together we need a pageBlockSectionItem with an Output panel.  We also needed to create a label so we know what field we are entering in -->
 <apex:pageblocksectionitem >
 <apex:outputlabel value="{!$ObjectType.Lead.Fields.FirstName.label}"></apex:outputlabel>
 <apex:outputpanel >
 <apex:inputfield value="{!Lead.Salutation}"></apex:inputfield>
 <apex:inputfield value="{!Lead.FirstName}"></apex:inputfield>
 </apex:outputpanel>
 </apex:pageblocksectionitem>
 <apex:inputfield value="{!Lead.MobilePhone}"></apex:inputfield>
 
 <apex:inputfield value="{!Lead.LastName}"></apex:inputfield>
 <apex:inputfield value="{!Lead.Fax}"></apex:inputfield>
 
 <apex:inputField value="{!Lead.Company}" />
 <apex:inputfield value="{!Lead.Email}" required="true"></apex:inputfield>
 
 <apex:inputfield value="{!Lead.Title}"></apex:inputfield>
 <apex:inputfield value="{!Lead.Website}"></apex:inputfield>
 
 <apex:inputfield value="{!Lead.Leadsource}"></apex:inputfield>
 <apex:inputfield value="{!Lead.Status}"></apex:inputfield>
 
 <!-- <apex:inputField value="{!Lead.Campaign}" />
 Campaign field is not able to be used unless you write your own custom class/method to create a campaign member
 Post explaining this issue: http://boards.developerforce.com/t5/Apex-Code-Development/Cannot-Access-to-Campaign-Field-from-Lead-Object/td-p/161715
 -->
 <apex:inputfield value="{!Lead.Rating}"></apex:inputfield>
 
 <apex:inputfield value="{!Lead.Industry}"></apex:inputfield>
 <apex:inputfield value="{!Lead.NumberOfEmployees}"></apex:inputfield>
 </apex:pageblocksection>
 
 <apex:pageblocksection id="AddressInformationPBS" title="Address Information">
 <apex:inputfield value="{!Lead.Street}"></apex:inputfield>
 <apex:outputtext value=""></apex:outputtext>
 
 <apex:inputfield value="{!Lead.City}"></apex:inputfield>
 <apex:outputtext value=""></apex:outputtext>
 
 <apex:inputfield value="{!Lead.State}"></apex:inputfield>
 <apex:outputtext value=""></apex:outputtext>
 
 <apex:inputfield value="{!Lead.PostalCode}"></apex:inputfield>
 <apex:outputtext value=""></apex:outputtext>
 
 <apex:inputfield value="{!Lead.Country}"></apex:inputfield>
 <apex:outputtext value=""></apex:outputtext> <!-- Don't Really need to implement this extra space, but it's not bad practice -->
 </apex:pageblocksection>
 
 <apex:pageblocksection id="AdditionalInformationPBS" title="Additional Information">
 <apex:inputfield value="{!Lead.ProductInterest__c}"></apex:inputfield>
 <apex:inputfield value="{!Lead.CurrentGenerators__c}"></apex:inputfield>
 
 <apex:inputfield value="{!Lead.SICCode__c}"></apex:inputfield>
 <apex:inputfield value="{!Lead.Primary__c}"></apex:inputfield>
 
 <apex:inputfield value="{!Lead.NumberofLocations__c}"></apex:inputfield>
 </apex:pageblocksection>
 
 <apex:pageblocksection id="DescriptionInformationPBS" title="DescriptionInformation">
 <apex:inputfield value="{!Lead.Description}"></apex:inputfield>
 </apex:pageblocksection>
 
 <apex:pageblocksection id="OptionPBS" title="Lead Information">
 <!-- If you want to have a checkbox to implement whether to use Active Assignment rules you will need to create your own using a custom Apex Extension and method -->
 Here we can place any extra fields or lead options we wish...
 </apex:pageblocksection>
 
 </apex:pageblock>
 
 </apex:form>
 
</apex:page>

 
Adriana VoyceAdriana Voyce
When I add this I get this error: Error: <apex:page> is required and must be the outermost tag in the markup at line 1 column 1

When I add that at the beginning I get this error:

[Error] Error: New_Lead line 2, column 11: Element type "apex:page" must be followed by either attribute specifications, ">" or "/>"
[Error] Error: Element type "apex:page" must be followed by either attribute specifications, ">" or "/>".
Prabhat Kumar12Prabhat Kumar12
Remove this line from your code "
Use this in your visualforce page. Don't forget mark as answer if it works for you. :)"
.