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
Siana DcruzSiana Dcruz 

Refer the current page dynamically

Hi
I have the following line of code written in my class to refer to the current Page: 
System.currentPageReference().getParameters().get('selectedTemplateId');

Can anyone help me replace this code so as to refer the current page dynamically?
 

Sudhir ChowdarySudhir Chowdary
Hi,

If you want to get parameters from current page use:
ApexPages.currentPage().getParameters().get('selectedTemplateId');

In your test class you can pass parameters to page by using:
PageReference.getParameters().put('id', myID);