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
Will EdwardsWill Edwards 

How do I have a two-stage lead creation process?

I would like to use Force.com, Visualforce, and Apex to create a two-stage lead creation process. I'd like for person A to access a Visualforce page on a Force.com site.

Here's the Visualforce code for the first nomination form.
<apex:page standardController="Lead"
           extensions="myWeb2LeadExtension"
           title="Submit Nominee for Digital Accelerator" showHeader="false"
           standardStylesheets="true">
 <apex:composition template="{!$Site.Template}">
  <apex:define name="body">
   <apex:form >
    <apex:messages id="error"
                   styleClass="errorMsg"
                   layout="table"
                   style="margin-top:1em;"/>
      <apex:pageBlock title="" mode="edit">
        <apex:pageBlockButtons >
           <apex:commandButton value="Submit"
                               action="{!saveLead}"/>
        </apex:pageBlockButtons>
        <apex:pageBlockSection title="Contact Us"
                               collapsible="false"
                               columns="1">
        <div class = "requiredInput">
        <div class = "requiredBlock"></div>
         <apex:inputField value="{!Lead.FirstName}" required="true"/>
         <apex:inputField value="{!Lead.LastName}" required="true"/>
         <apex:inputField value="{!Lead.Title}" required="true"/>
         <apex:inputField value="{!Lead.Email}" required="true"/>
         <apex:inputField value="{!Lead.Company}" required="true"/>
        </div>
        <input type="hidden" name="Campaign_ID" value="{$CurrentPage.parameters.MeetingValue}" />
        </apex:pageBlockSection>
     </apex:pageBlock>
   </apex:form>
  </apex:define> 
 </apex:composition>
</apex:page>
And the Apex controller:
public class myWeb2LeadExtension {

    private final Lead weblead;

    public myWeb2LeadExtension(ApexPages.StandardController
                                stdController) {
       weblead = (Lead)stdController.getRecord();
    }

     public PageReference saveLead() {
       try {
       insert(weblead);
       }
       catch(System.DMLException e) {
           ApexPages.addMessages(e);
           return null;
       }
       PageReference p = Page.ThankYou;
       p.setRedirect(true);
       return p;
     }
}
This will create a lead with some of the information. I'd then like to send a link to the nominee with most of the information filled in and request they add some follow up information. I was thinking of having a hidden value of the lead ID passed through the URL and then writing an Apex controller to update that specific lead.

Any recommendations?

 
ManojSankaranManojSankaran
Hi Edward,

This can be acheieved using salesforce.com sites as you have mentioned. The only limitation that we have in sites is that, Lead can be viewed and created but not edited or deleted from the sites.


As per my understanding the sales team will partially fill the lead details and send the url to lead itself. So leads will open the URL and they will create update the remaining fields in leads and save the record.

If my above understanding is correct. Below is the option that we can make use of.
1. We need a custom object to store the First half of the lead information.
2, The sales team will create a record in that custom object and we can use a workflow rule to send email to the email id present in that record with the ID of the record.
3. In sites we can use the VF Page to display the values from the Custom Object and will also display the remaining lead fields that they are forced to fill. Later we can save all the information in the lead.and at the same time we can delete the custom object record. after inserting the lead record.

Let me know if you have any question in this model.


Thanks
Manoj S
 
Will EdwardsWill Edwards
Manoj, I've gone a different direction. Thanks, though.