function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
JavajJavaj 

Flex Code not invoking in visual force - login error [sandbox]

I have written a sample Flex code and i tried to invoke it through a visual force page.

 

1. 

 

It worked fine with my developer instance(i.e., it was fetching the desired records). But it is not working with the Sandbox instance.

 

The connection part of the code [developer]:

 

 

<salesforce:Connection id="conn" serverUrl="https://www.salesforce.com/services/Soap/u/16.0" />

 

 and for sandbox:

  <salesforce:Connection id="conn" serverUrl="https://test.salesforce.com/services/Soap/u/16.0" />

Is there any modification that i need to do here to make it work in sandbox? [But, it was able to fetch the records when i tried to run the code directly from Flex builder].

Any help on this matter will be appreciated.

 

2.

 

Issue while authenticating:

 

I have tried to directly passing the username and password by hardcoding them in the code and also through Session ID.

Both of them Failed.

 

I would ideally like to pass the session Id and make it work

 

[However, both the methods worked in my developer edition]

 

private function doLogin():void
{
var lr:LoginRequest = new LoginRequest();

lr.username = "mySandboXusername@mydomain.com.test";
lr.password = "$$$$$$$$$$";

//lr.session_id = this.parameters.sid;
//lr.server_url = this.parameters.surl;

lr.callback = new AsyncResponder(loginResult, loginFault);
conn.login(lr);
}

 

 

 The Visual Force page from where i am invoking the flex is:

 

 

<apex:page >
<apex:pageBlock title="Flex Page">
<apex:flash src="{!$Resource.flex}" width="500" height="300" play="true" />
flashvars="sid={!$Api.Session_ID}&surl={!$Api.Partner_Server_URL_90}"/>

</apex:pageBlock>
</apex:page>

 

 The query part involved in the flex code is:

 

 

private function loginResult(result:Object):void
{
conn.query("SELECT Id, Contact.Firstname,phone, Contact.Lastname FROM Contact",
new AsyncResponder(queryResult));
}

 

 

 

Can some one please help me out on this.

If not,  even if you can even point me in the right direction, that would be great!

 

 

 

 

Message Edited by Javaj on 06-26-2009 06:13 AM
Best Answer chosen by Admin (Salesforce Developers) 
gtuerkgtuerk

Although unacknowledged by SF as an issue, wintamute helped me out by having me get the session ID in my page controller (rather than using the Global variable in the VF page).  See this thread:

 

 

Session ID Global unpredictable

 

 

 

All Answers

gtuerkgtuerk

Although unacknowledged by SF as an issue, wintamute helped me out by having me get the session ID in my page controller (rather than using the Global variable in the VF page).  See this thread:

 

 

Session ID Global unpredictable

 

 

 

This was selected as the best answer
JavajJavaj


Thank you very much gtuerk. it is working for me perfectly!

Big Thanks.

 

 

Message Edited by Javaj on 06-29-2009 04:24 PM