• turntwo463
  • NEWBIE
  • 0 Points
  • Member since 2009

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 3
    Replies
From within my Flex application, I would like to link back to detail pages for records selected in the application. I have tried doing this by using ExternalInterface to execute the “window.open” command passing a URL of the following format:

Frontdoor URL/objected?sessionId={session id from connection’s login result}&serverlUrl={server Url from connection}

https://na7.salesforce.com/701A00000004swV?sessionId=00DA00000ZZZZZFNplK_BCCYkWUV&serverUrl=https://na7-api.salesforce.com/services/Soap/u/15.0/00DA00000004csV

I’ve tried this with and without the serverUrl parameter.

While a new browser window is opened, the request is redirected to:

https://login.salesforce.com/

with a message:

You have attempted to access a page that requires a salesforce.com login. If you are already a user of the system, please login below.

Once I provide username and password, the correct detail page is opened.

So, what am I missing here? Is it possible to open the detail page directly? Can someone direct me to any documentation?

Thanks in advance for your assistance,
David

I am looking for a way to introspect a custom report to understand the fields that make up the report.  In one example I've created a custom report by saving one of the standard reports, Opportunity Pipeline.

 

The metadata for this report begins with:

 

<Report xmlns="http://soap.sforce.com/2006/04/metadata">
    <columns>
        <field>FULL_NAME</field>
    </columns>
    <columns>
        <field>OPPORTUNITY_NAME</field>
    </columns>
    <columns>
        <field>TYPE</field>
    </columns>
    <columns>
        <field>LEAD_SOURCE</field>
    </columns>
    <columns>
        <aggregateTypes>Sum</aggregateTypes>
        <field>AMOUNT</field>
    </columns>
    <columns>
        <aggregateTypes>Sum</aggregateTypes>
        <field>EXP_AMOUNT</field>
    </columns>

...

 

Looking at the metadata one can make an educated guess that the EXP_AMOUNT column relates to the Expected Revenue field for the Opportunity object, etc.

 

However, I would like to be able to make this connection programmatically.  Is there additional metadata that can be accessed that captures the relationship between EXP_AMOUNT and Expected Revenue?  If not, are these relationships documented somewhere?

 

Thank you,

David

 

I have created a Flex component that I've now deployed as both an S-Control and a Visualforce page.  The Flex code attempts to use the session id and server url for logins. These values are passed in as Flash variables. When this code is invoked from the S-Control the login succeeeds.  However the login fails when invoked from the Visualforce page. (I can also login with username and password from the page).


The html body for the S-Control:

<!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="FlexSalesforce" 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_140}" />
<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_140}&externalURL=https://na6.salesforce.com/resource/123XXXX89000/salesforceRSL"
loop="false" allowScriptAccess="always" type="application/x-shockwave-flash"
pluginspage="http://www.adobe.com/go/getflashplayer">
</embed>
</object>
</body>
</html>



The syntax of my page is:

<apex:page sidebar="true" showheader="true">
<apex:flash src="{!$Resource.Example5}" height="500" width="100%"
         flashvars="session_id={!$Api.SESSION_ID}&server_url={!$Api.Partner_Server_URL_140}&externalURL={!$Resource.salesforceRSL}"/>
</apex:page>

 

Within my Flash component, the following code snippet gets called:

 

               var connection:Connection = new Connection();

                var sessionId:String = Application.application.parameters[SESSION_ID];
                var serverUrl:String = Application.application.parameters[SERVER_URL];
                if (sessionId != null && serverUrl != null)
                {
                    LOG.debug("Using session id for login");
                    lr.server_url = serverUrl;
                    lr.session_id = sessionId;
                    loginResponder = new AsyncResponder(loginCallback);
                    lr.callback = loginResponder;

                    //connection.protocol = "https";   //tried with and without setting these
                    //connection.serverUrl = serverUrl;

                    connection.login(lr);
                }

 

I've noticed that the sessionId's are different for the page vs. the S-Control even though they are invoked from the same browser moments apart. I've also noticed that the URLs for the control use "https://na6.visual.force.com" vs. "https://c.na6.visual.force.com" for the page.


I'm seeing the following output in my logs for the page case:

 

Starting login
Using session id for login

loginWithSessionId(
 sid: 510600  [....]  _p4DIBpWrGf
 surl: https://c.na6.visual.force.com/services/Soap/u/14.0/510600D80000000ZTCY
);
App Domain = c.na6.visual.force.com
Api Server name = c.na6.visual.force.com
_internalServerUrl = https://c.na6.visual.force.com/services/Soap/u/14.0/510600D80000000ZTCY
loading the policy file: https://c.na6.visual.force.com/services/Soap/cross-domain.xml
Your application must be running on a https server in order to use https to communicate with salesforce.com!
invoke getUserInfo
intServerUrl is null
intServerUrl = https://c.na6.visual.force.com/services/Soap/u/14.0/510600D80000000ZTCY
_invoke getUserInfo
'0078EE29-37C1-427B-78E0-AE6DF3EE2F28' producer set destination to 'DefaultHTTPS'.
Method name is: getUserInfo
'direct_http_channel' channel endpoint set to http://c.na6.visual.force.com/resource/1235576467000/
'0078EE29-37C1-427B-78E0-AE6DF3EE2F28' producer sending message 'B769C4FE-87A6-A2E6-F4DA-AE6DF3FD5ABB'
'direct_http_channel' channel sending message:
(mx.messaging.messages::HTTPRequestMessage)#0
  body = "<se:Envelope xmlns:se="http://schemas.xmlsoap.org/soap/envelope/"><se:Header xmlns:sfns="urn:partner.soap.sforce.com"><sfns:SessionHeader><sessionId>510600D80000  [...]        dDV1hVMr_p4DIBpWrGf</sessionId></sfns:SessionHeader></se:Header><se:Body><getUserInfo xmlns="urn:partner.soap.sforce.com" xmlns:ns1="sobject.partner.soap.sforce.com"/></se:Body></se:Envelope>"
  clientId = (null)
  contentType = "text/xml; charset=UTF-8"
  destination = "DefaultHTTPS"
  headers = (Object)#1
  httpHeaders = (Object)#2
    Accept = "text/xml"
    SOAPAction = """"
    X-Salesforce-No-500-SC = "true"
  messageId = "B769C4FE-87A6-A2E6-F4DA-AE6DF3FD5ABB"
  method = "POST"
  recordHeaders = false
  timestamp = 0
  timeToLive = 0
  url = "https://c.na6.visual.force.com/services/Soap/u/14.0/510600D80000000ZTCY"
'0078EE29-37C1-427B-78E0-AE6DF3EE2F28' producer connected.
Method name is: getUserInfo
'0078EE29-37C1-427B-78E0-AE6DF3EE2F28' producer acknowledge of 'B769C4FE-87A6-A2E6-F4DA-AE6DF3FD5ABB'.
responseType: Fault
Saleforce Soap Fault: sf:INVALID_SESSION_ID
INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session
(com.salesforce.results::Fault)#0
  context = (null)
  detail = (Object)#1
    UnexpectedErrorFault = (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"
Error: Ignoring policy file requested from https://c.na6.visual.force.com/crossdomain.xml because a cross-domain redirect to https://na6.salesforce.com/crossdomain.xml occurred.
Warning: Domain c.na6.visual.force.com does not explicitly specify a meta-policy, but Content-Type of policy file https://c.na6.visual.force.com/services/Soap/cross-domain.xml is 'text/x-cross-domain-policy'.  Applying meta-policy 'by-content-type'.
 

 

Thanks in advance for your help.

David



Hi

 

I have a problem using the Flex Toolkit for salesforce.  I would greatly appreciate if anyone patiently reads this and helps me out.

 

The following are the steps I followed:

 

1. Created a flex project in Flex Builder 3

2. Dropped in the salesforce.mxml file as a startup application

3. Included the as3Salesforce.swc in the library path

4. Entered my own developer username and password into this (salesforce.mxml) file

5. Set the Setup --> Administration Setup --> Security Controls --> Session Settings --> 'Require secure connections (HTTPS)' Checkbox to FALSE

6. Built the project and ran the application salesforce.mxml


Now this works perfectly fine if I run this from my Flex Builder, and I have no issues.

 

Then, what I did was, I exported this as a ".swf" file and uploaded it as a Static Resource in another developer org. of mine. I then embedded this onto a VF Page.

 

Now, when I access this VF Page, the "login" operation works perfectly fine (logging into my 1st developer org) and I get the following text in the "ta.text" Textarea:

 

Login successful:
(com.salesforce.results::LoginResult)#0
  context = (null)
  passwordExpired = false
  serverUrl = "https://na7-api.salesforce.com/services/Soap/u/9.0/...............

 

 

Here is my issue. When I try to do any other operation after this, like "describeSObjects" / "describe all" and so on, I receive this error:

 

fault from operation: (mx.rpc::Fault)#0
  content = (null)
  errorID = 0
  faultCode = "Channel.Security.Error"
  faultDetail = "Destination: DefaultHTTP"
  faultString = "Security error accessing url"
  message = "faultCode:Channel.Security.Error faultString:'Security error accessing url' faultDetail:'Destination: DefaultHTTP'"
  name = "Error"
  rootCause = (flash.events::SecurityErrorEvent)#1
    bubbles = false
    cancelable = false
    currentTarget = (flash.net::URLLoader)#2
      bytesLoaded = 0
      bytesTotal = 0
      data = (null)
      dataFormat = "text"
    eventPhase = 2
    target = (flash.net::URLLoader)#2
    text = "Error #2170: Security sandbox violation: http:<my developer org 2 VF Page URL> cannot send HTTP headers to https://na7-api.salesforce.com/services/Soap/u/9.0/<dev org 1 ID>."
    type = "securityError"

 

 

 Could anyone tell me why exactly this happens and what is the Solution?

 

 I checked out the community Posts:

 

 

  • http://community.salesforce.com/sforce/board/message?board.id=ajax_toolkit&message.id=2741
  • http://community.salesforce.com/sforce/board/message?board.id=general_development&message.id=11600

 

 

and tried them out, but doesn't seem to work.

 

 

I would greatly appreciate any help on this issue.

 

Thank You.

Message Edited by Suri on 10-09-2009 06:20 PM
Message Edited by Suri on 10-14-2009 04:39 PM
  • October 09, 2009
  • Like
  • 0
Why is there no "Flex / Air" developer board category ?

Anyone seen this error before?  I am trying to run a flex app on a web server.


(com.salesforce.events::ApexFaultEvent)#0

  bubbles = false

  cancelable = true

  context = (null)

  currentTarget = (null)

  eventPhase = 2

  fault = (mx.rpc::Fault)#1

    errorID = 0

    faultCode = "Server.Error.Request"

    faultDetail = "Error: [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032: Stream Error. URL: http://www.salesforce.com/services/Soap/u/11.0"]. URL: http://www.salesforce.com/services/Soap/u/11.0"

    faultString = "HTTP request error"

    message = "faultCode:Server.Error.Request faultString:'HTTP request error' faultDetail:'Error: [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032: Stream Error. URL: http://www.salesforce.com/services/Soap/u/11.0"]. URL: http://www.salesforce.com/services/Soap/u/11.0'"

    name = "Error"

    rootCause = (flash.events::IOErrorEvent)#2

      bubbles = false

      cancelable = false

      currentTarget = (flash.net::URLLoader)#3

        bytesLoaded = 0

        bytesTotal = 0

        data = (null)

        dataFormat = "text"

      eventPhase = 2

      target = (flash.net::URLLoader)#3

      text = "Error #2032: Stream Error. URL: http://www.salesforce.com/services/Soap/u/11.0"

      type = "ioError"

  message = (mx.messaging.messages::ErrorMessage)#4

    body = (Object)#5

    clientId = "DirectHTTPChannel0"

    correlationId = "026E48D3-1BFD-8AA6-A5D6-CDE8A1C8B7D8"

    destination = ""

    extendedData = (null)

    faultCode = "Server.Error.Request"

    faultDetail = "Error: [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032: Stream Error. URL: http://www.salesforce.com/services/Soap/u/11.0"]. URL: http://www.salesforce.com/services/Soap/u/11.0"

    faultString = "HTTP request error"

    headers = (Object)#6

    messageId = "154CD995-435D-2011-47FB-CDE8A2A25895"

    rootCause = (flash.events::IOErrorEvent)#2

    timestamp = 0

    timeToLive = 0

  messageId = "154CD995-435D-2011-47FB-CDE8A2A25895"

  target = (null)

  token = (mx.rpc::AsyncToken)#7

    message = (mx.messaging.messages::HTTPRequestMessage)#8

      body = "<se:Envelope xmlns:se="http://schemas.xmlsoap.org/soap/envelope/"><se:Header xmlns:sfns="urn:partner.soap.sforce.com"/><se:Body><login xmlns="urn:partner.soap.sforce.com" xmlns:ns1="sobject.partner.soap.sforce.com"><username>xxxxxxxx@xxxxxx.com</username><password>xxxxxxxxxxxxx9KYz1Hmt965XXXXQcNVpjaq61</password></login></se:Body></se:Envelope>"

      clientId = (null)

      contentType = "text/xml; charset=UTF-8"

      destination = "DefaultHTTP"

      headers = (Object)#9

        DSEndpoint = "direct_http_channel"

      httpHeaders = (Object)#10

        Accept = "text/xml"

        SOAPAction = """"

        X-Salesforce-No-500-SC = "true"

      messageId = "026E48D3-1BFD-8AA6-A5D6-CDE8A1C8B7D8"

      method = "POST"

      recordHeaders = false

      timestamp = 0

      timeToLive = 0

      url = "http://www.salesforce.com/services/Soap/u/11.0"

    responders = (Array)#11

      [0] (::SalesForceResponder)#12

    result = (null)

  type = "fault"