function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
mmaxtrammaxtra 

How to get ID from Page?

Hi:

   I have an s-control which is linked to a button which is linked to a VF page.

"/apex/editQuoteLineBatch?Id={!xxx__c.Id}"

 

How do I get the xxx ID into the VF page input box?

 

Thanks for your help in advance.

 

Best Answer chosen by Admin (Salesforce Developers) 
Anand@SAASAnand@SAAS
Read the "id" parameter in the controller's constructor and set it to the corresponding controller variable. For e.g.

public Pagecontroller{ public String idParam {get; set;} public PageController{ this.idParam = ApexPages.currengPage().getParameters().get('id'); }}

 And the page would look like this:

 

<apex:page controller="PageController"><apex:form><apex:inputText value="{!idParam}"/></apex:form></apex:page>

 You might want to think about using a controller extension instead of trying to do this. Read teh respective documentation on the Developer site.

 

 

All Answers

Anand@SAASAnand@SAAS
Read the "id" parameter in the controller's constructor and set it to the corresponding controller variable. For e.g.

public Pagecontroller{ public String idParam {get; set;} public PageController{ this.idParam = ApexPages.currengPage().getParameters().get('id'); }}

 And the page would look like this:

 

<apex:page controller="PageController"><apex:form><apex:inputText value="{!idParam}"/></apex:form></apex:page>

 You might want to think about using a controller extension instead of trying to do this. Read teh respective documentation on the Developer site.

 

 

This was selected as the best answer
MMA_FORCEMMA_FORCE

Thank You Mr. Anand...I understood it and it helped me out... What I do not get is how come I can not link a button to my VF Page instead of me making a S-Control.

I am trying to play around with the salesforce.com app QuoteLine. 

But thanks