+ Start a Discussion
Gaurav RajGaurav Raj 

How to retrieve the id of an Object dynamically

If following is my vf page: How to write the controller to obtain the fields with the id dynamically passed?

 

<apex:page standardController="Account">
<apex:form>
<apex:pageBlock title="My Content" mode="edit">
<apex:pageBlockButtons>
<apex:commandButton action="{!save}" value="Save"/>
</apex:pageBlockButtons>
<apex:pageBlockSection title="My Content Section" columns="2">
<apex:inputField value="{!account.name}"/>
<apex:inputField value="{!account.site}"/>
<apex:inputField value="{!account.type}"/>
<apex:inputField value="{!account.accountNumber}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

souvik9086souvik9086

Check this. You have to create an extension and use the getRecord() method and then can get the record.

 

http://www.salesforce.com/us/developer/docs/pages/Content/pages_controller_extension.htm

 

 

Kathir DevanKathir Devan

Hi,

 I placed here java script code please check it and you can get object id

 

{!RequireScript("/js/functions.js")}

var recordsSelected = {!GetRecordIds($ObjectType.Lead)}
for(var i=0; i < recordsSelected .length ; i++) {
alert('Selected ID. '+recordsSelected[i]);
}

 

Regards,

kathir