• raj78
  • NEWBIE
  • 0 Points
  • Member since 2009

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 2
    Replies

I've been using Google Chrome as the browser for developing the flex custom controls, and just found out it doesn't work in IE.

 

I have a simple control which retrieves information from the Lead record and populates it in a data grid. It works perfectly fine in the Chrome browser, but doesn't work in IE.

 

Can someone please help me here? I'm attaching the code which works fine in crome & not in IE.

 

<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="login()">

<mx:Script>

<![CDATA[

import mx.events.ItemClickEvent;

import com.salesforce.*;  

        import com.salesforce.objects.*;  

        import com.salesforce.results.*;  

        import mx.collections.ArrayCollection;  

        import mx.controls.Alert;  

        

        [Bindable] public var sfdc:Connection = new Connection();

//Login information into salesforce.com

private function login():void {  

  

            var lr:LoginRequest = new LoginRequest();  

            lr.server_url = this.parameters.server_url;   

            lr.session_id = this.parameters.session_id;  

               

            lr.callback = new AsyncResponder(loginSuccess, loginFault);  

            sfdc.login(lr);      

        }

        

        

 

        [Bindable] private var physical_zip:String = new String;

        [Bindable] private var leadid:String = new String;

 

 

        

      

              private function getData():void  

        {  

  leadid = this.parameters.lead_id;

            sfdc.query("Select FirstName, LastName, " + 

             "Physical_Zipcode__c " + 

             "FROM Lead WHERE Id = '"+leadid+"'  ",  

                 new AsyncResponder(  

                    function (qr:QueryResult):void {

                     var ar:ArrayCollection = new ArrayCollection();

                        if (qr.size > 0) {  

                            for (var j:int=0;j<qr.size;j++) {  

                                 ar.addItem(

                 {lead_fname:qr.records[j].FirstName, 

                 lead_lname:qr.records[j].LastName,                

                 physical_zip:qr.records[j].Physical_Zipcode__c});

                            }

                            lead.columns = [new DataGridColumn('lead_fname'), 

             new DataGridColumn('lead_lname'),

             new DataGridColumn('physical_zip')];

             lead.dataProvider = ar;

                            

 

                        }  

                    },sfdcFailure  

                )  

            );     

  

        }

        

        

 

        

        

        //Invoke function to retrieve data

private function loginSuccess(result:Object):void {  

            getData();  

                   

        }                                  

  

        private function sfdcFailure(fault:Object):void {  

            Alert.show(fault.faultstring);  

        }     

  

        private function loginFault(fault:Object):void  

        {  

            Alert.show("Could not log into SFDC: "+fault.fault.faultString,"Login Error");  

        }

        

        

]]>

</mx:Script>

 

<mx:DataGrid x="283" y="292" id="lead">

<mx:columns>

<mx:DataGridColumn headerText="Column 1" dataField="col1"/>

<mx:DataGridColumn headerText="Column 2" dataField="col2"/>

<mx:DataGridColumn headerText="Column 3" dataField="col3"/>

</mx:columns>

</mx:DataGrid>

</mx:Application> 

  • April 22, 2009
  • Like
  • 0

I'm trying to create a inline Flex control which displays a chart based on the account record. I need to get the AccountID for that record.

 

Can anyone tell me how to get the AccountID in the Flex control? 

  • March 03, 2009
  • Like
  • 0

Can anyone please let me know how to call a apex class from a Flex control? I have written a apex class which performs search queries and returns the lead records based on the user entered criteria.

 

Any help would be appreciated 

  • March 03, 2009
  • Like
  • 0
Code:
<—xml version="1.0" encoding="utf-8"–>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
 xmlns:salesforce="com.salesforce.*"
 applicationComplete="login();">

<mx:DateFormatter id="dateform" formatString="MM"/>
<mx:NumberFormatter id="numform" precision="0"/>

<mx:Script>
 <![CDATA[
  import flash.external.ExternalInterface;
  import com.salesforce.results.QueryResult;
  import mx.collections.ArrayCollection;
  import com.salesforce.AsyncResponder;
  import com.salesforce.objects.LoginRequest;
  import mx.controls.dataGridClasses.DataGridColumn;
  private function login():void {
   apex.login( new LoginRequest({
    server_url : this.parameters.server_url,
    session_id : this.parameters.session_id,
    callback : new AsyncResponder(render)
    })
    );
  }
  private function render(result:Object):void {
   var currId:String = ExternalInterface.call("getID");
   apex.query("Select Amount, CloseDate, OwnerId from Opportunity where AccountId='{!Account.Id}' and Probability=100",
     new AsyncResponder(
     function (qr:QueryResult):void
     {
      var month:int = 0;
      var x:int = 0;
      var amt:Array = new Array(0,0,0,0,0,0,0,0,0,0,0,0,0);
      var name:Array = new Array(" "," "," "," "," "," "," "," "," "," "," "," "," ");
      var months:Array = new Array("0","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
      var ar:ArrayCollection = new ArrayCollection();
      values.dataProvider = ar;
      for(var j:int=0;j<qr.records.length;j++) {
       month=numform.format(dateform.format(qr.records[j].CloseDate));
       amt[month]+=qr.records[j].Amount;
       apex.query("Select Name from User where Id='"+qr.records[j].OwnerId+"'",
       new AsyncResponder(
       function (qr2:QueryResult):void
       {
        name[x]=qr2.records[0].Name;
        x++;
       },
       function (fault:Object):void {}
       ));
      }
      ar=createArray(months, amt, name, ar);
     },
     function (fault:Object):void {}
  ));
 }
 private function createArray(months:Array, amt:Array, name:Array, ar:ArrayCollection):ArrayCollection {
  for(var i:int=1;i<13;i++)
  {
   ar.addItem( {Month:months[i], Amount:amt[i], Name:name[i]});
  }
  return(ar);
 }
 ]]>
</mx:Script>

<salesforce:Connection id="apex" />
 <mx:ColumnChart x="118" y="46" id="values">
  <mx:series>
   <mx:ColumnSeries displayName="Opp Amounts" yField="Amount"/>
   <mx:ColumnSeries displayName="Owner" yField="Owner"/>
  </mx:series>
 </mx:ColumnChart>
 <mx:Legend dataProvider="{values}"/>
 
</mx:Application>

I'm learning how to code simple Flex graphs, and I'm trying to push all my information into the ArrayCollection ar. The problem is that, regardless of what method I try, I'll put a breakpoint on the line return(ar) and a breakpoint on the line x++ under my second AsynchResponder. Inevitably, the return(ar) function will activate PRIOR to the breakpoint for x++, which means none of my names are initialized before the ArrayCollection is created. How does one 'wait' for all the data to be returned?
 


Message Edited by MattL on 01-28-2008 11:38 AM
  • January 25, 2008
  • Like
  • 0
Hello,

From R3.7 I found metadata api methods (e.g. createObject) are newly added, and I also found some scripts like CustomObject.as are also included in source code folder of that release.

However, when compiling I encountered compile error telling no CustomObject class found in .swc file.

It seems that there is some difference between released binary file and bundled source code. Of course I can workaround by compiling the toolkit from source code file, but wellcome to be fixed officialy.
  • August 21, 2007
  • Like
  • 0