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
JaredPHJaredPH 

help for newbie? Simple(?) vf code for entering new leads

I am brand spanking new at VF development.

 

I have created a lookup relationship on the standard lead object that will relate to other leads. I have the related list for this relationship showing up on the lead page with a "new" button. I would like to customize the page that comes up when I click "new" (or a custom button that I create--"new friend") so that rather than the standard new lead page with all the lead fields, it only comes up with 4 or 5 designated lead fields such as first name, last name, email, and phone. Is this something simple enough to do?

 

I can create the new button and attach a custom VF page to it, but not sure (1) what to put in the VF code of the custom page so that the 4 or 5 fields entered will be relate the new lead record to the related (parent/lookup) lead and (2)how to put the 4 or 5 fields into the code. Sorry, that's not much that I can do--just getting started. Thanks for any help you can give.

Suresh RaghuramSuresh Raghuram

Hi JaredPH.

 

This just a rough example for the simple vf Page for standard object. Once you do this you get lot of doubts.

keep post them i will help you. If this answers your question mark as solution to your question.

Thanks

 

<apex:page standardController="Account" extensions="DupeRecordsInOutputpanelExt">
<apex:pageMessages ></apex:pageMessages>
<apex:pageBlock id="btnSection" >
    <apex:pageBlockSection >
        <apex:pageBlockSectionItem >Name<apex:inputText value="{!accName}"/></apex:pageBlockSectionItem>
        <apex:pageBlockSectionItem >Phone<apex:inputText value="{!accPhone}"/></apex:pageBlockSectionItem>
    </apex:pageBlockSection>

< apex:commandButton value="Save" action="{!save}" rendered="{!!showSave}"/>

            <apex:commandButton value="Cancel" action="{!cancel}" />


</apex:PageBlock>
</apex:form>


 
</apex:page>

CONTROLLER CODE

public class DupeRecordsInOutputpanelExt {

public DupeRecordsInOutputpanelExt(ApexPages.StandardController controller) {
        account = (Account)controller.getRecord();
public PageReference save(){
    
        account.Name = accName;
        account.Phone = accPhone;
        
        Insert account;
        
        PageReference pageRef = new ApexPages.StandardController(account).view();
        pageRef.setRedirect(true);
        return pageRef;
    }        
public PageReference cancel(){
        return null;
    }

}


JaredPHJaredPH

Thanks!

 

Getting this. Not sure what it means, so not sure how to fix it:

 

ErrorError: referfriendpage line 9, column 2: The content of elements must consist of well-formed character data or markupErrorError: The content of elements must consist of well-formed character data or markup.

Suresh RaghuramSuresh Raghuram

you wrote some thing wrong in the vf page component.

 

jst looking at error i can say only this post your code snippet also it is easy to help you

JaredPHJaredPH

I cut and pasted your code and changed "account" references to "lead". No other changes.

 

Thanks again.

Suresh RaghuramSuresh Raghuram

hey dude first paste upto page block in the vf page then the remaining in the apex class with the name in the controller(class name)

Suresh RaghuramSuresh Raghuram

rendered="{!!showSave}" remove any of the rendering  and chek is there any unnecessary spaces or charecters

dont hesitate to ask questions if u have any , I am happy to answer you.

 

if this solves your issue mark it as solution