+ Start a Discussion

How to pass contact id and contact lookup fields in to visual force page?

I want auto populate contact and account fields when ever we create Opportunity record from contacts related list. But  below was not giving as expected results...please anyone make correct.

PageReference pr = new PageReference('/apex/OppVfPage?CF00N40000002fEB2={!Contact.Name}&CF00N40000002fEB2_lkid={!Contact.Id}&conid={!Contact.Id}');

after page opens the contact or account fields were not populated and the URL displays like...


Chandra Sekhar CH N VChandra Sekhar CH N V
Try using the below : 
PageReference <some var>= new PageReference ('/apex/OppVfPage?Id=' + contact.Id);
Hi Anvesh,
Can you please clarify below points for which I can suggest some solution .

.1.Have you created custom button and add in contcat related List to create Opportunity .
2.Is the button over ridden with VF page or you redirect to standard opportunity layout .
3.What all fields you need to populate from Account and Contact ?