You need to sign in to do that
Don't have an account?
Maxplore
Sending data from Salesforce application to Flex
Anyone has idea about how to send data from Salesforce application to Flex.
Use case is that I need to display the details of selected Account record in my Flex application that is loaded as an SWF file linked to a S-Control. For that I need to send the Account # to flex application. After getting the Account # in Flex, I can use Salesforce API to get the data for passed Account #. But I am unable to find as to how to send data from Salesforce to Flex.
If thats not possible, is there any API call using which I can find out the details of the current record?
inside the scontrol where you have the embed tag, just add another var for Account id , fill this in with "{!Account.Id}"
look for
flashvars="session_id={!API.Session_ID}&server_url={!API.Partner_Server_URL_90}"
add this
&accid={!Account.Id}"
then in the flash application, you can read this by using the Application object
Application.application.parameters.server_url
Application.application.parameters.session_id
so
Application.application.paramaters.accid;
Thanks for the quick reply Ron.
I have done the same as suggested by you but my flex application is still not getting the value of the variable.
I have created a custom object "RMA_Shipment_Order" and have a "Name" field in it.
In the S-Control, I embedded "&rmaid={!RMA_Shipment_Order__c.Name}" and in my Flex application I am reading the variable as
txName.text = Application.application.parameters.rmaid;
I also tried
txName.text = this.parameters.rmaid;
Nothing works. Can you please let me know if I am missing something?
Thanks in advance.
Its working now. My mistake. I put the paramater in embed tag instead of flashvars tag.
Thanks for your prompt help Ron.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head></head>
<body scroll="no" >
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="InvoiceLineList" width="100%" height="100%"
codebase="https://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
<param name="movie" value="{!Scontrol.JavaArchive}" />
<param name="quality" value="high" /><param name="play" value="true" />
<param name="bgcolor" value="#f3f3ec" /><param name="allowScriptAccess" value="always" />
<param name="flashvars" value="session_id={!API.Session_ID}&server_url={!API.Partner_Server_URL_90}&accid={!Account.AccountNumber}" />
<embed src="{!Scontrol.JavaArchive}" play="true" bgcolor="#f3f3ec" width="100%" height="700"
name="FlexSalesforce" align="middle"
flashvars="session_id={!API.Session_ID}&server_url={!API.Partner_Server_URL_90}&accid={!Account.AccountNumber}"
loop="false" allowScriptAccess="always"
type="application/x-shockwave-flash"
pluginspage="http://www.adobe.com/go/getflashplayer">
</embed>
</object>
</body>
</html>
I am using accid to read the account number from my account object and then am assigning it to a variable in the flex code. I have also tried to pass static key/value pairs through flashvars as a test with no joy.What am I doing wrong?