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
Mikron AdminMikron Admin 

Return URL for a page

Hello,

 

When I cancel an operation on a Visualforce page, I would like to return to the calling page.

 

In my case, the Visualforce  page is invoked from a custom button placed on an object view.

 

Is it possible to get an object view URL? I tried, but I could not find a specific merge field to pass the current page URL as a parameter (retURL).

GoodGrooveGoodGroove

Use the Standard Controller {!Cancel} method to return to the previous view

 

<apex:commandbutton action="{!cancel}" value="Cancel"/>

 

otherwise, if you are using a controller extension you can use Page Reference

 

 

public PageReference cancel() { return new ApexPages.StandardController(c).view();}

 


 

 

prageethprageeth

You meant something like this ?

 

<apex:page standardController="opportunity">

Current page URL = {!$CurrentPage.URL} 

</apex:page> 

 

Or do you want a solution with an Apex controller?