+ Start a Discussion
Himanshu SHimanshu S 

Passing Parameters to custom VF page



I have a custom object named booh__c, which I have added as a related list to 'Opportunity'.


Now I have a custom button 'Assign Booth' on this related list which points to my VF page as:


Execute Javascript:

window.location.href = "/apex/customBooths"



I want that when this page opens, it shows the opportunity field filled in with the value from where this page was called. 

This functionality is already available for standard buttons (New etc) ... but I dont know how to implement it for my VF page.


Please help.




Best Answer chosen by Admin (Salesforce Developers) 



Never tried this before but I think it'll work:


window.location.href = "/apex/customBooths?oppId={!$CurrentPage.Parameters.id}"


Some similar examples can be seen here: http://wiki.i-dialogue.com/(S(s2lidw555m1vwl45vvrbibvn))/Default.aspx?Page=Adding_Custom_Buttons_to_Salesforce_Records&AspxAutoDetectCookieSupport=1


And then in the controller for the customBooths page you can retrieve the OppId parameter.