[SalesForce] How to pass two Id within URL using getParameters().put

currently I send one Id in the URL to my other controller but now I have to send another value within the same URl to my other controller , how can I add the second value to this

PageReference opptyPage = new PageReference('/apex/PBXOrdering');
       opptyPage.getParameters().put('id', Opportunity.id);
      opptyPage.setRedirect(true);

what I wish,

PageReference opptyPage = new PageReference('/apex/PBXOrdering');
       opptyPage.getParameters().put('id', Opportunity.id + 'xyz', currenId);
      opptyPage.setRedirect(true);

also how do I receive both Id's individual for my two different variables?

Best Answer

Simply add both to the map:

opptyPage.getParameters().put('id', Opportunity.id);
opptyPage.getParameters().put('xyz', currenId);

On the page where the data is retrieved from, just read the parameters back using the get method:

ApexPages.currentPage().getParamters().get('id');
ApexPages.currentPage().getParamters().get('xyz');
Related Topic