+ Start a Discussion
AffinaquestAffinaquest 

Problem with login and Adbobe flex

I've started working with Adobe flex and have copied the code from "Creating a Flex Mashup on Force.com" (found on this page: http://wiki.developerforce.com/index.php/Creating_a_Flex_Mashup_on_Force.com) in its entirety.

 

I've also tried the two other example provided by Salesforce on this page: http://wiki.developerforce.com/index.php/Getting_Started_with_the_Force.com_Toolkit_for_Adobe_AIR_and_Flex.

 

When I run the second sample i get these messages in the console: 

[SWF] demo.swf - 1,551,229 bytes after decompression

offline but we will succeed at logging in anyways

query - offline

SQLError: 'Error #3115: SQL Error.', details:'no such table: 'Contact'', operation:'execute', detailID:'2013'

Select Id, FirstName, LastName FROM `Contact`;

SQLError: 'Error #3115: SQL Error.', details:'no such table: 'Contact'', operation:'execute', detailID:'2013'

Select Id, FirstName, LastName FROM `Contact`;

 

It seems to imply that I'm off line, but I'm not.

 

In any event, it appears that I am unable to login in either case.

 

Does anyone have any idea of what might be going wrong?

 

Thanks for your help.

Best Answer chosen by Admin (Salesforce Developers) 
ShmeeShmee

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/halo" minWidth="1024" minHeight="768"
xmlns:salesforce="http://www.salesforce.com/"
applicationComplete="doLogin()"
>

<mx:DataGrid top="122" left="249" id="mygrid"/>



<fx:Script>
<![CDATA[
import com.salesforce.AsyncResponder;
import com.salesforce.objects.LoginRequest;
import com.salesforce.results.LoginResult;
import com.salesforce.results.QueryResult;

private function doLogin():void{

var lr:LoginRequest = new LoginRequest();
lr.username = "***@h***.com";
lr.password = "Q***1wDK8b7*****uIc";
lr.callback = new AsyncResponder(loadGrid);
force.login(lr);

}

private function loadGrid(lr:LoginResult):void
{
force.query("Select id, Name From Contact",
new AsyncResponder( function(qr:QueryResult):void{
mygrid.dataProvider = qr.records;
})
);
}

}
]]>
</fx:Script>




<fx:Declarations>
<salesforce:Connection id="force" />
</fx:Declarations>
</s:Application>

 

That is my code that I got it working with.  Hope that helps.  Also you Connection object will change if you have an AIR application or a WEB application.  I believe for Air it is <salesforce:AIRConnection />

 

Hope that helps

All Answers

designdesign
Try to add security token to your password. It solved the problem to me.
alberto_ilalberto_il

Hi,

 

I have the same issue and the security token didn't solve - Any Idea?

 

Thanks,

 

Alberto

 

ShmeeShmee

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/halo" minWidth="1024" minHeight="768"
xmlns:salesforce="http://www.salesforce.com/"
applicationComplete="doLogin()"
>

<mx:DataGrid top="122" left="249" id="mygrid"/>



<fx:Script>
<![CDATA[
import com.salesforce.AsyncResponder;
import com.salesforce.objects.LoginRequest;
import com.salesforce.results.LoginResult;
import com.salesforce.results.QueryResult;

private function doLogin():void{

var lr:LoginRequest = new LoginRequest();
lr.username = "***@h***.com";
lr.password = "Q***1wDK8b7*****uIc";
lr.callback = new AsyncResponder(loadGrid);
force.login(lr);

}

private function loadGrid(lr:LoginResult):void
{
force.query("Select id, Name From Contact",
new AsyncResponder( function(qr:QueryResult):void{
mygrid.dataProvider = qr.records;
})
);
}

}
]]>
</fx:Script>




<fx:Declarations>
<salesforce:Connection id="force" />
</fx:Declarations>
</s:Application>

 

That is my code that I got it working with.  Hope that helps.  Also you Connection object will change if you have an AIR application or a WEB application.  I believe for Air it is <salesforce:AIRConnection />

 

Hope that helps

This was selected as the best answer