+ Start a Discussion
anvesh@force.comanvesh@force.com 

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...

https://c.cs15.visual.force.com/apex/OppVfPage?CF00N40000002fEB2=%7B%21Contact.Name%7D%3FCF00N40000002fEB2_lkid%3D%7B%21Contact.Id%7D%3Fconid%3D%7B%21Contact.Id%7D

 
Chandra Sekhar CH N VChandra Sekhar CH N V
Try using the below : 
PageReference <some var>= new PageReference ('/apex/OppVfPage?Id=' + contact.Id);
ManojjenaManojjena
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 ?