Get current page query string parameters in apex

  • How does one to get query string parameters with apex in a controller and eventually into a visualforce page?

  • Jaguar

    Jaguar Correct answer

    6 years ago

    This would be a clean way to do it:

    apexPages.currentPage().getParameters().get();
    
    // For URL - http://test.salesforce.com/apex/helloworld?q=texas
    
    
    //use the following
    String queryString ='';
    queryString = ApexPages.currentPage().getParameters().get('q');
    

    Source

License under CC-BY-SA with attribution


Content dated before 7/24/2021 11:53 AM

Tags used