You need to sign in to do that
Don't have an account?
Error Loggin In in Flex using Latest sForce Toolkit for Flex
I'm trying to develop in Flex Builder 3, but I doesn't seems to be able to Log In.
Here is what I'm trying to do:
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:airforce="http://www.salesforce.com/air"
applicationComplete="initApp()" horizontalScrollPolicy="off" status="{airConnection.connected ? 'Online' : 'Offline'}" xmlns:salesforce="http://www.salesforce.com/">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
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({
server_url: this.parameters.server_url,
session_id: this.parameters.session_id,
username: "UsernameONLY",
password: "PasswordONLY",
callback: new AsyncResponder(function (result:Object):void { getContacts(); })
});
airConnection.login(lr);
}
private function getContacts(o:Object=null):void
{
Alert.show(airConnection.connected.toString());
if (airConnection.connected) {
Alert.show(airConnection.IsLoggedIn.toString());
airConnection.query("Select Id, FirstName, LastName From Contact LIMIT 10", new AsyncResponder(
function (qr:QueryResult):void {
dg.dataProvider = qr.records;
},handleFault)
);
}
}
private function handleFault(fault:Object):void
{
Alert.show('ERROR : ' + fault.toString());
}
]]>
</mx:Script>
<!-- <airforce:AIRConnection id="airConnection"/> -->
<salesforce:AIRConnection id="airConnection"/>
<mx:DataGrid id="dg" width="100%" height="100%"/>
<mx:HBox>
<mx:Button label="Get Contacts" click="getContacts()"/>
<mx:Button label="Create New Contact">
<mx:click>
var acc:SObject = new SObject('Contact');
acc.FirstName = 'Test';
acc.LastName = 'Contact ' + (new Date()).time;
airConnection.create([acc], new AsyncResponder(
function (result:Object):void
{
getContacts();
})
);
</mx:click>
</mx:Button>
<mx:Button label="Force Offline" click="airConnection.forceNetworkStatusChange(false)" enabled="{airConnection.connected}"/>
<mx:Button label="Force Online" click="airConnection.forceNetworkStatusChange(true)" enabled="{!airConnection.connected}"/>
</mx:HBox>
</mx:WindowedApplication>
In this code, the BLUE colored Alert Line displayed "true" (i.e. Connection is Connected). The RED colored Alert Line displays "False" (i.e. User is Not Logged In, DESPITE providing the correct Username and Password to my Developer Org).
Also, I tried calling the Fault Handle function to Query function, but it also doesn't seems to be working, this Error is thrown on clicking the "Get Contacts" button:
query - offline
SQLError: 'Error #3115: SQL Error.', details:'no such table: 'Contact'', operation:'execute', detailID:'2013'
Select Id, FirstName, LastName FROM `Contact` LIMIT 10;
SQLError: 'Error #3115: SQL Error.', details:'no such table: 'Contact'', operation:'execute', detailID:'2013'
Select Id, FirstName, LastName FROM `Contact` LIMIT 10;
Can anybody help me. I was looking to get started with FLEX development but doesn't seems to get things right :(.
ALSO please note that I have to disable <airforce:AIRConnection> this Line of code from the actual tutorial. Do this seems to be an issue because using this was cauing this exception:
"Could not resolve <airforce:AIRConnection> to a component implementation"
I'm getting the same error attempting to use the example code in
"Taking Salesforce Data Offline Using Adobe AIR"
http://wiki.developerforce.com/index.php/Taking_Salesforce_Data_Offline_Using_Adobe_AIR
Fails here:
<airforce:AIRConnection id="airConnection"/>
With this message:
Could not resolve <airforce:AIRConnection> to a component implementation.
Yes done that, but the error is sustaining like not going, I've checked and tried building simplest to simplest examples on different machines but I'm not able to Login, status is shown logged in but when I fetch any records it throws me an error that object does not extist.
Hi,
I'm facing the same issue. I've downloaded force-air.swc and force-flex.swc from https://code.google.com/p/force-flex/downloads/list and added into Flex project but it did not solve this issue. Any suggestion?