I have created one custom object called Site, and I have created a lookup from Opportunity to that Custom object. Now I can see the opportunity related list in my custom object, there one button called New Opportunity also available. My client wanted me to change the button name and put the Visual force page which I created for Custom object inside that one. I can't change the standard button so I have gone to the Custom button option. I have created a custom button and given the type as List Button and content source as URL and inside the button I have written the below statement. As expected, I can call the visual force page to that button. But the only issue I can not call the custom object field values inside the visual force page. In the below statement I have referred the Visual force page and custom object fields. Please guide me in this issue.

/apex/Convert_site?{!Site__c.Site_Ref_No__c}{!Site__c.Name} {!Site__c.Site_Address__c}{!Site__c.Project_City__c}{!Site__c.State__c}{!Site__c.Post_code__c}{!Site__c.Account__c}{!Site__c.Completion_Date__c}?

1 Answer 1


When calling your custom page you need to correctly format and encode the URL parameters.


Notice how each parameter is separated by an ampersand (&) and prefixed with a key. Also, each parameter is wrapped in a URLENCODE so that special URL characters will be correctly encoded.

Then, in your custom visualforce page controller you can access the parameters passed to the page.

string siteRefNo = ApexPages.CurrentPage().getParameters().get('refNo');

Since the Site custom object already exists it should be sufficient to pass the Id and then run a SOQL query in the page controller to retrieve the required records.

  • Thank you so much for the detailed code Daniel. I will try this and let you know the result.
    – Arun
    Commented May 28, 2013 at 9:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .