I am trying to fetch the account records from the queryResult of Salesforce to Salesforce integration response. But unable to split from the data. Can someone please help me.
string query1 = 'Select Id, Name, phone from Account limit 10';
partnerSoapSforceCom.QueryResult qr = new partnerSoapSforceCom.QueryResult();
qr = partner.Query_http(query1);
List<sobjectPartnerSoapSforceCom.sObject_x> sobjectlist = qr.records;
for(sobjectPartnerSoapSforceCom.sObject_x aa : sobjectlist ){
system.debug('aa.type_x---'+aa.type_x);
system.debug('aa.fieldsToNull---'+aa.fieldsToNull);
system.debug('aa.anyElement---'+aa.anyElement);
}
Here the output response from the above debug log is like below...
(sObject_x:[Id=0013I000003wus6QAA, Id_type_info=(Id, urn:sobject.partner.soap.sforce.com, ID, 1, 1, true), anyElement=(XMLNode[ELEMENT,Id,urn:sobject.partner.soap.sforce.com,null,null,[XMLNode[TEXT,null,null,null,null,null,0013I000003wus6QAA,]],null,], XMLNode[ELEMENT,Name,urn:sobject.partner.soap.sforce.com,null,null,[XMLNode[TEXT,null,null,null,null,null,test Account,]],null,], XMLNode[ELEMENT,Phone,urn:sobject.partner.soap.sforce.com,[common.apex.api.dom.XmlNode$Attribute@73219693],[common.apex.api.dom.XmlNode$NamespaceDef@777814a5],null,null,]), anyElement_type_info=(anyElement, urn:sobject.partner.soap.sforce.com, List<DOM.XmlNode>, 0, 1, true), apex_schema_type_info=(urn:sobject.partner.soap.sforce.com, true, false), field_order_type_info=(type_x, fieldsToNull, Id, anyElement), fieldsToNull=(), fieldsToNull_type_info=(fieldsToNull, urn:sobject.partner.soap.sforce.com, string, 0, -1, true), type_x=Account, type_x_type_info=(type, urn:sobject.partner.soap.sforce.com, string, 1, 1, false)]).
Here I am doing Salesforce to Salesforce integration with SOAP using Partner WSDL. Here I want to query Account records from one org to another org. Here using query_Http method to query records. And we are getting results as mentioned above(as expected).
From the above result I want to fetch only account record information (Id, Name fields) from the response body and store that result into Account object.