+ Start a Discussion
SurpriseSurprise 

Apex and Eneterprise WSDL

Hi ,

 

In  salesorce to salesforce connection,after quering for records.I assume that I have few returned records.Now I want to
check the size of the records  an then do further processing.Does anyone knows how to check the size of as I am stuck here?.After querying the records have been returned in enterpriseSoapSforceCom.QueryResult g  object and size fucntion do not belong to this ,infact it belonmgs to collections.How do I this?

 

 

enterpriseSoapSforceCom.soap binding = new enterpriseSoapSforceCom.soap();
enterpriseSoapSforceCom.LoginResult lr = binding.login('jack123@yahoo.com','jackcjZCb80EPTaIce9SXTCRXpoHC');  system.debug('The value in the lr of loginresult is'+lr);
//Update the binding endpoint as per the LoginResult
binding.endpoint_x = lr.ServerUrl;
System.debug('The value after setting the binding of the binding.endpoint_x+'+binding.endpoint_x);
binding.SessionHeader = new enterpriseSoapSforceCom.SessionHeader_element();
binding.SessionHeader.sessionid=lr.sessionid;
System.debug('The value in variable of sesion id is'+binding.SessionHeader.sessionid);
String soqlQuery = 'SELECT FirstName, LastName FROM Contact';
//enterpriseSoapSforceCom.QueryResult l = binding.describeglobal();
enterpriseSoapSforceCom.QueryResult g=binding.query(soqlQuery);
                                
         
                     if (g.size() > 0)
                        {
                            
                        }    
              

Avidev9Avidev9
well size method should work.
Have a look here at QueryResult class http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_query_queryresult.htm
SurpriseSurprise

Thanks Avi and that thing worked.However,I am using  records property  and assigning to sobject array so that I can loop through returned records and do further processing .Please look at the code below.Line in red is giving an error :-

 

Illegal assignment from list to list .

 

I am sure what is that I missing .

 

enterpriseSoapSforceCom.soap binding = new enterpriseSoapSforceCom.soap();
enterpriseSoapSforceCom.LoginResult lr = binding.login('jack@yahoo.com',jack123cjZCb80EPTaIce9SXTCRXpoHC');  
system.debug('The value in the lr of loginresult is'+lr);
//Update the binding endpoint as per the LoginResult
binding.endpoint_x = lr.ServerUrl;
System.debug('The value after setting the binding of the binding.endpoint_x+'+binding.endpoint_x);
binding.SessionHeader = new enterpriseSoapSforceCom.SessionHeader_element();
binding.SessionHeader.sessionid=lr.sessionid;
System.debug('The value in variable of sesion id is'+binding.SessionHeader.sessionid);
string s='Select firstname,lastname from contact limit 3';
//enterpriseSoapSforceCom.QueryResult l = binding.describeglobal();
enterpriseSoapSforceCom.QueryResult g=binding.query(s);
boolean b=false;
if(g.size>0)
   {
       b=true;
       System.debug('The value in the boolean variable b is'+b);
       while (!g.done)
       {
       sObject[] records=g.records;
       for (integer i = 0; i < records.Length; i++)
                  {
                     Contact con = (Contact)records[i];
                     string fName = con.FirstName;
                     string lName = con.LastName;
       
                   
                       }
   }

   }