1

This question already has an answer here:

I have an apex method with return type PageReference. When the method returns value a custom visualforce page is loaded. I want to pass few parameters from the method to the visualforce page. At the moment I'm using the following method:

pageRef.getParameters().put('accIds', allAccIds);

The problem here is that when the visualforce page is loaded in the browser then all parameters are included in the URL as GET parameters.

Is there a way in Salesforce to pass them as POST parameters so they are not displayed and visible in the URL address?

marked as duplicate by Raul, Eric apex Mar 16 '17 at 3:57

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Did you try using setRedirect as false in pagereference? – Raul Mar 15 '17 at 20:34
0

You can leverage Http POST method to send data.

String body = 'accIds' + allAccIds;
HttpRequest req = new HttpRequest();
req.setEndpoint('***https://my_endpoint.example.com/some_path***');
req.setMethod('POST');
req.setbody(body);
Http http = new Http();
HTTPResponse response = http.send(req);

Not the answer you're looking for? Browse other questions tagged or ask your own question.