• jamis0n
  • NEWBIE
  • 0 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies

Hi,

 

I have created Flex grid, on while I want to populate Account sObject's data.

 

Code of mxml file, After successful build, I have uploaded .swf file into static resource.

<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:salesforce="http://www.salesforce.com/" creationComplete="login(event)"> <salesforce:Connection id="apex" serverUrl="https://www.salesforce.com/services/Soap/u/9.0" /> <mx:Script> <![CDATA[ import mx.collections.ArrayCollection; import com.salesforce.results.QueryResult; import mx.utils.ObjectUtil; import mx.controls.Alert; import com.salesforce.AsyncResponder; import com.salesforce.objects.LoginRequest; private function login(event:Event):void { var lr:LoginRequest = new LoginRequest(); // lr.server_url = parameters.surl; // lr.session_id = parameters.sid; Alert.show(parameters.session_id); Alert.show(parameters.server_url);

// session_id and serverurl is giving authentication error in Firefox, IE, Safari

lr.session_id = parameters.session_id; lr.server_url = parameters.server_url;

 // username and password is working fine only in Firefox, and IE, Safari gives connection error

/* lr.username = "SFDC_username" lr.password = "SFDC_password"; */

 

lr.callback = new AsyncResponder(loadData, handleFault); apex.login(lr); } [Bindable] private var accountList:ArrayCollection = new ArrayCollection(); private function handleFault(fault:Object):void { Alert.show(ObjectUtil.toString(fault)); } private function loadData(lr:Object):void { apex.query("Select Name, Phone, Type From Account", new AsyncResponder( function(qr:QueryResult):void { if (qr.size > 0) { accountList = qr.records; } }, handleFault) ); } ]]> </mx:Script> <mx:DataGrid dataProvider="{accountList}" left="10" right="10" top="10" bottom="10"> <mx:columns> <mx:DataGridColumn dataField="Name"/> <mx:DataGridColumn dataField="Phone"/> <mx:DataGridColumn dataField="Type"/> </mx:columns> </mx:DataGrid> </mx:Application>

 

Visualforce page code (SimpleFlexGrid.page):

<apex:page > <!-- Begin Default Content REMOVE THIS --> <h1>Congratulations</h1> This is your new Page: SimpleFlexGrid <!-- End Default Content REMOVE THIS --> <apex:flash id="flexSOs" src="{!$Resource.SimpleFlexGrid}" height="100%" width="100%" flashvars="session_id={!$Api.Session_ID}&server_url={!$Api.Partner_Server_URL_90}"/> </apex:page>

 

While loading  /apex/SimpleFlexGrid page, I am  following error;

 

(com.salesforce.results::Fault)#0
  context = (null)
  detail = (Object)#1
    fault = (Object)#2
      exceptionCode = "INVALID_SESSION_ID"
      exceptionMessage = "Invalid Session ID found in SessionHeader: Illegal Session"
      xsi:type = "sf:UnexpectedErrorFault"
  faultcode = "sf:INVALID_SESSION_ID"
  faultstring = "INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session"

 

 

Flashvars in apex:flash tag gives above error in all browser.

 

But if I remove flashvars, and hardcode username, and password in actionScript, everything is working fine except in safari browser.

 

Any help on flashvars session_id, server_url would be appreciated.

 

Thanks,

Ankur