I have overridden the view page of opportunity and based of certain scenarios I am redirecting to different pages.

Initially I have used window.location.href inside outputpanel tag to redirect to different pages like:

<script>window.location.href="{!$Site.Prefix}{!URLFOR('/'+opportunity.id+'?nooverride=1', opportunity.id, null, true)}"<script>

As both script and window.location have uncertain behavior in lightning view so I have written extension controller and directly called action method to handle redirection.

But I want to access the opportunity.id parameter in action method of custom controller. Can someone please suggest how to pass dynamic param value - opportunity.id to action method of apex:page tag.


  • Is it an extension controller ? – Mohith Shrivastava Aug 25 '16 at 13:10
  • Yes, I have create a extension controller. – Y Singh Aug 25 '16 at 14:34

You will need a simple extension controller ,

public with sharing class OpptControllerExtn {
private final Opportunity opp;

public OpptControllerExtn (ApexPages.StandardController stdController) {
    this.opp = (Opportunity)stdController.getRecord();


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.