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
Marco Antonio CalvoMarco Antonio Calvo 

Visualforce page. Know previous page

Hia @ll

I created a custom functionality to change several records in a custom object and I'm also create one button to access it. 
My problem is that I don't know how to return to the previous page once the action is completed.
You can invoke the button in a related list view or in a list view so I don't have a defined return list. I always want to go back to the page where the action is executed.
Is it possible to get this information?  
I'm usingin lighting experience.
Try this:
public PageReference goBack(){
        Pagereference pr = new pagereference('/apex/<your_page_name>');
        return pr;