2

when click on edit button need to open record in next tab in edit mode its opening my page but its not in edit mode format

<apex:outputLink value="/apex/Population/?id={!st.id}" target="_blank"> 
  Edit
</apex:outputLink>

enter image description here

4
  • If you want to link to the edit view, why is the value a Visualforce Page?
    – Adrian Larson
    Feb 28, 2017 at 6:06
  • @AdrianLarson first i need to show page like image uploaded it shows perfect now second step is when click on edit button then needed in edit view. thats why vfpage create Feb 28, 2017 at 6:14
  • 1
    why don't you try directly like this {!st.id}/e. This will open your record directly in standard edit view. Feb 28, 2017 at 6:15
  • 1
    Add 'recordId/e?nooverride=1' in query parameter if your edit screen is overridden with a visualforce page.
    – Raul
    Feb 28, 2017 at 6:18

1 Answer 1

6

The best practice way to link to a record's edit page is to use the $Action global variable.

<apex:outputLink value="{!URLFOR($Action.MyObject__c.Edit, record.Id)}">

It's not really clear why you are trying to involve a Visualforce Page in this equation.

Note that there is a bit more to the syntax of the URLFOR function:

{!URLFOR(target, id, [inputs], [no override])} and replace target with the URL or action, s-control, or static resource merge variable, id with a reference to the record, and inputs with any optional parameters. The no override argument is also optional and defaults to “false.” It applies to targets for standard Salesforce pages such as $Action.Account.New. Replace no override with “true” when you want to display a standard Salesforce page regardless of whether you have defined an override for it elsewhere.

To access a Visualforce page, simple [sic] enter the name of your page preceeded by an “apex/.” For example, if your Visualforce page is named myTestPage, you would use {!URLFOR("apex/myTestPage"}.

So if you wanted to ensure the default edit page should be used, you might additionally specify no override:

URLFOR($Action.MyObject__c.Edit, record.Id, [/*inputs*/], /*noOverride*/ true)
2
  • Would be nice if you mention how to pass additional query parameters, if you think that'd be helpful.
    – Raul
    Feb 28, 2017 at 6:19
  • @RahulSharma done.
    – Adrian Larson
    Feb 28, 2017 at 6:24

You must log in to answer this question.

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