enter code here

<apex:page standardController="fleet_Car_Set__c" showHeader="true">

    <object style="height : 1200px;width : 1300px;overflow:hidden;">
    <form id="frm" action="http://XXX/?username=ZZZ_UserName&password=PWD&retUrl={/apex/response}" method="POST">

      //  <input type="hidden" id="username" value="ZZZ_UserName"/>  //Tis input tag not working, so directly passed Username and password in action only.
        // <input type="hidden" id="password" value="PWD"/>
        // <input type="Json" id="JSON" value="('{!fleet_Car_Set__c.JSON_String__c}')"/>---
    alert("Inside Script");
    alert('{!Fleet_Car_Set__c.JSON_String__c}');//---Here we are getting full JSON data, need to post this JSON to External System(http://XXX/).

I need to Post JSON data to external System, above is my code I tried, but no luck. Please help me to achive this.

  • Basically in salesforce we take rest API help to make callout to external system and pulled/pushed the data in external system. REST API Developer Guide – Ratan Paul Apr 7 '16 at 6:19
  • By including a username and password in your page you are allowing someone who wants to hack direct access to the external system which is usually dangerous. Making the request from the server-side in Apex avoids that problem. – Keith C Apr 7 '16 at 7:19
  • We will take care of the security part later, as of now I need to Post the JSON to external Url. Not through Apex. Please help me out. – Mite Apr 7 '16 at 7:37
  • I am able to submit a GET request. Are you too able to make a GET request and not able to submit a POST? – Saumya Ranjan Satapathy Apr 7 '16 at 13:43

Set the name attribute;

<input type="Json" name="JSON" id="JSON" value="{!fleet_Car_Set__c.JSON_String__c}"/>

It is working for me when I post a GET request to a url action= "http://localhost:8080/XXX".


is fine. No need to add extra '' or ()

  • the above code works, only mistake was in input Name, that external system was not identifying. Thank you very much for you help:) – Mite Apr 8 '16 at 8:06
  • Now I am able to post the JSON with POST request to External System. – Mite Apr 8 '16 at 8:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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