14 May 2012 8:07 AM #1
Unanswered: Connecting Salesforce.com from a Sencha or ExtJS App??
I have been hitting my head all around to connect to a Salesforce.com instance from within a Sencha 2.0 App. I tried using the following 2 approaches
1. SF AjaxToolkit : http://www.salesforce.com/us/developer/docs/ajax/Content/sforce_api_ajax_introducing.htm
Here i tried using both 'sforce.connection.login( )' and 'sforce.connection.remoteFunction( )'
2. Force.com Rest: https://github.com/developerforce/Fo...t-REST-Toolkit
While the 1st approache throws a "Cross Domain" exception, the second one requires hosting of Proxy.php used to route the REST API Calls again to avoid "Cross Domain" issue.
I am intending to build a Sencha Touch2.0 Mobile App, so i may not be able to host a local proxy.php within the Mobile container (please correct me if my understanding is wrong).
Can you please guide me with a workaround or approach to connect to Salesforce.com with either of the above 2 approaches? Anything else which can help me authenticate the Salesforce instance and query data from the same would be Welcome.
Last edited by developer-greenova; 14 May 2012 at 7:46 PM. Reason: Need to add some more details
16 May 2012 4:57 AM #2
- Join Date
- Mar 2007
- Gainesville, FL
- Vote Rating
If you are getting a cross origin error then the server doesn't support CORS. You have 3 choices, have the server support CORS (which you don't have control over), have the server support JSONP (which the server may not) or have your own server side code that won't have cross origin issues.Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Software Engineer
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services email@example.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!
When posting code, please use BBCode's CODE tags.
26 May 2012 6:05 AM #3
Can you pls elaborate the 3rd option of own server code?
To keep it simple, how do i connect to salesforce? Can you share some sample Sencha code demonstrating the same...?