Skip to main content
Greg Coogan a posé une question dans #Apex
I need to do a HTTP POST where I set parameters in the headers. This will be triggered via custom button, but it cannot be a Javascript button. I cannot use PageReference for a redirect since it would b e a seperate operation from the POST. How can I get the POST operation to open/redirect to an external website as part of the POST operation?

I've reviewed existing documentation and also other forum posts, but none of them address my specific scenario.

I've got my Apex code written that is executed when the custom button loads a Visualforce page that passes data to the Apex code. I am just unable to get it to direct the user as part of the POST operation.
11 réponses
  1. 26 juin 2018, 16:07
    How about in your VF page you submit a form using JavaScript instead of using Action method.  On that VF page, you construct a form that contains all the info either using hidden fields or using JavaScript, then when page is loaded, it automatically submits that form.  But if that is the case, you may be able to submit that form in your Custom Button (not sure if you could submit form in a custom button though but you could try).
0/9000