+ Start a Discussion

How to display visualforce page in edit page layout

Hi ,
I have created a VF page containing  form which has 4 address fields(street,city,state,country) those are populated by autocomplete functionality using 3rd party application .
I want to display this in edit page of opportunity object .
Later I knew that vf page  cannot be placed in edit page layout .
So I looked into button overriding options , But there is a issue  , The opportunity object has 4 record types/4 page layouts .
If I override the new / edit button with the automplete VF page along with other input fields(replicate edit pagelayout fields)  , the display would be same irrespective of record types .
This will cause a mismatch in fields display or page layouts will be ineffective .

1) So for edit functionality , should I create 4 apex pages to display  fields form 4 correspodning page layouts and check which record type is checked , So the Vf page can be dynamically choosen ?
2) And what about autocomplete VF page? since this functionality is common , Can I convert this Vf page to VF component ,so It can be used in all 4 page layouts?
Regarding the 

Harish M 8Harish M 8
No, no need to create 4 pages...
Create one VF page where u need to put on EDIT operation...
remaining three will be redirect to Standard URL

Here while overriding, you need to use VF page and controller, so in that controller redirect that particular record type to newly created vf page

like below

public PageReference doAction(){
string pageUrl;
if(recordtype == 'ur recordtype where u need VF for EDIT')
pageUrl='/apex/urpagename?parameters which u can use';
PageReference pr=new PageReference(pageUrl);
        return pr;
        return null;

so in else condition u need to give standard URL format
for this just edit on those remaining recordtype records...copy URL
identify the parameters which salesforce is using, then send those values dynamically in else condition....\
Hi Harish ,

Thanks for the reply , But my questions if I redirect to standard URL using recordtype ,how can I display the VF snippnet(autocomplete VF page) in the edit page layout .
I have a req to show the VF snippnet in all 4 edit page layouts .