You need to sign in to do that
Don't have an account?
![dkccraig dkccraig](https://dfc-org-production.my.site.com/img/userprofile/default_profile_45_v2.png)
Log in to Sandbox via Flex
Hi all,
I have a standalone Flex app, e.g. not embedded in a VF page.
I can log into a non-sandbox org, but I cannot seem to log into a sandbox org.
I have tried changing the LoginRequest.server_url property to "https://test.salesforce.com" and "http://cs2.salesforce.com" with no luck, and I also tried changing xmlns:salesforce= to both of these values as well.
How is this meant to be attained?
Thanks!
The endpoint override is an attribute of the <connection tag.
<apex:Connection id="apexConn" serverUrl="https://www.salesforce.com/services/Soap/u/9.0"/>
All Answers
Changing the hostname in your endpoint URL to test.salesforce.com should work. What's happening when you try? What response are you getting from the server?
I have the same issue. Wasted half the day trying to find an answer to this question without any luck :(
Anyone able to enlighten us?
Thank you!
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:salesforce="http://www.salesforce.com/" creationComplete="initApp()"> <mx:Script> <![CDATA[ import com.salesforce.objects.SObject; import com.salesforce.results.QueryResult; import com.salesforce.AsyncResponder; import com.salesforce.objects.LoginRequest; private function initApp():void { var lr:LoginRequest = new LoginRequest({ username: "xxxx.devSB", password: "XXXXX", callback: new AsyncResponder(function (result:Object):void { getContacts(); })}); connection.login(lr); } private function getContacts(o:Object=null):void { connection.query("Select Id, FirstName, LastName From Contact limit 10", new AsyncResponder( function (qr:QueryResult):void { dg.dataProvider = qr.records; })); } ]]> </mx:Script> <salesforce:Connection id="connection"/> <mx:DataGrid id="dg" width="100%" height="100%"/> </mx:Application>
Sandbox users have to log in to a different URL than production users.
I don't see anywhere in your code where you set the API endpointURL to "test.salesforce.com" instead of "www.salesforce.com". The production login service won't recognize your user "xxxx.devsb".
Hey JonP, I know you are trying to help but we do not know how to set the endPoint and that is what we are asking.
If you know how to point to the test server I am sure we would both greatly appreciate your input.
Thank you.
The endpoint override is an attribute of the <connection tag.
<apex:Connection id="apexConn" serverUrl="https://www.salesforce.com/services/Soap/u/9.0"/>
Don't know if anyone is following this thread but after much trial and error here is the solution:
<salesforce:Connection id="connection" serverUrl="https://cs3.salesforce.com/services/Soap/u/9.0"/>
Notice that it points directly to the sandbox url.
Devangel, if you know of a place with good developer documentation on Salesforce's flex I would appreciate it. I have only found very simple demos that lack the required details to build much more then what they do.
As mentioned in my previous respons, there is documentation included in the Force.com Toolkit for Flex and AIR download.
If you are using Adobe Flash Builder for Force.com, there are links on the toolkit page to a developer guide and to the ASDoc.
Developer Guide: http://wiki.developerforce.com/index.php/Adobe_Flash_Builder_for_Force.com_Developer_Guide
Reference Doc: http://wiki.developerforce.com/stratus_api/
Thank you Devangel, that is exactly what I was looking for.
Thank you JonP, I sware I tried test.salesforce yesterday just by guessing and it didnt work that is why I gave up on setting it via the connection but I must have had a typo somewhere.