I have a org with lightning experince is enabled. In that, i have overridden New action of a object with visualforce page.

I was passing id value into that new action as below,

Pagereference pRef = new PageReference('https://' + getFinalUrl() +'.lightning.force.com/one/one.app?isdtp=p1#/sObject/' + opp.Id + '/new');

Then in the overridden page i could able to grab id as below,

String rId = (ApexPages.currentPage().getParameters().containsKey('id')) ? ApexPages.currentPage().getParameters().get('id') : null;

But from Spring 17', ApexPages.currentPage().getParameters() doesn't contain id parameter (for new page overrides).

How can i solve this issue ? I just need to pass id value from one visualfore page to another in lightning experince.

1 Answer 1


From Spring 17 release notes:

Changes to the order of Visualforce page URL parameters can affect your Visualforce overrides. If you use a Visualforce page to override an action without encoding the parameter’s value, your users encounter an error when trying to take that action.

So you should encode your URL before returning it.

String encoded = EncodingUtil.urlEncode(url, 'UTF-8');

In your case, it should be something like this:

String url = 'https://' + getFinalUrl() +'.lightning.force.com/one/one.app?isdtp=p1#/sObject/' + opp.Id + '/new';
String encoded = EncodingUtil.urlEncode(url, 'UTF-8');
Pagereference pRef = new PageReference(encoded);
return pRef;

Go through this link for more info on this.

  • @Rohith I'm getting "Formula Expression is required on the action attributes" error
    – ChamingaD
    May 9, 2017 at 5:35
  • You need to use forward slash in your URL, like this: /apex/newPage May 9, 2017 at 5:37
  • Tried "String url = '/one/one.app#/sObject/'+opp.Id+'/new';" but still same. Can you give me an example ?
    – ChamingaD
    May 9, 2017 at 5:54

You must log in to answer this question.

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