Print this page

How to set the end point url in sforce.connection using AJAX Toolkit

Knowledge Article Number 000180782
Description I am using sforce.connection.login to log in to the Sandbox and retrieve data from it to process it accordingly. During the testing phase, it worked fine however when I migrated it to the Production, it failed. The reason was that in the production, it was trying to log in to login.salesforce.com hence it was failing. Moreover when it was in the Sandbox ,it got logged in to test.salesforce.com and hence passed the test . I need to know how to set the endpoint url in this. It worked fine when going from sandbox to sandbox or from production to production but vice-verse it did not work.
Resolution
To set end point URL using ajax toolkit is not possible as it is documented by salesforce that end point URL is always auto generated when try include following java script i.e. :-
 
<script src="/soap/ajax/27.0/connection.js" type="text/javascript"></script>
 
While using this we can only define username & password.End point url & session Id are always auto generated.Can check with following documented link by salesforce.
 
http://www.salesforce.com/us/developer/docs/ajax/apex_ajax.pdf
 
The alternative for this is only that we can use Web service or WSDL if customer is not able to use AJAX Toolkit properly.
 
http://www.salesforce.com/us/developer/docs/ajax/Content/sforce_api_ajax_queryresultiterator.htm




promote demote