You need to sign in to do that
Don't have an account?
Milan
However to my great sirprise the XML response that I had recieved was as follows :
SOQL Query retrieval Order.
Hello,
I had a simple Query to be fired. The query is as follows :
Select LastName,Company,PostalCode from lead where lastName = 'SomeLastName' and ...
The response that I recieve I parse as follows :
Code:// Select LastName, Company , PostalCode from lead where String lastName = fields[0].getValue(); String companyName = fields[1].getValue(); String scf = fields[2].getValue();
However to my great sirprise the XML response that I had recieved was as follows :
Code:
i.e the company is first and the lastName is after the Company Name . Now, that takes my code up for a toss.... :)
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="urn:partner.soap.sforce.com" xmlns:ns1="urn:enterprise.soap.sforce.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:sf="urn:sobject.enterprise.soap.sforce.com"> <soapenv:Body> <queryResponse> <result> <ns1:done>true</ns1:done> <ns1:queryLocator xsi:nil="true"/> <ns1:records xsi:type="sf:Lead"> <sf:Company>Catholic Health Initiatives</sf:Company> <sf:LastName>Peach</sf:LastName> <sf:PostalCode>802</sf:PostalCode> </ns1:records> <ns1:records xsi:type="sf:Lead"> <sf:Company>Catholic Health Initiatives</sf:Company> <sf:LastName>Martin</sf:LastName> <sf:PostalCode>802</sf:PostalCode> </ns1:records>
i.e the company is first and the lastName is after the Company Name . Now, that takes my code up for a toss.... :)
I was preeety sure that I had seen retrieving the values based on position in some of the Salesforce doc. But anyways, does it mean that retrieving values like :
String lastName = fields[0].getValue();
String companyName = fields[1].getValue();
String companyName = fields[1].getValue();
is NOT THE RIGHT WAY TO DO THINGS ???
I guess, I should be retrieving values based on ElementNames...
BTW, is this anything to do with Partner API vis-a-vis Enterprise API. My guess is, and only a guess, I was not having this issue as long as I was using the partner API but I think its more evident in Enterprise API. Is it ?
Anyways, what would be the right approach to retrieve values ?
Any feedback appreciated.
Thanks,
Milan
For the partner API, fields are returned in the order used in the query statement.
For the Enterprise API, fields are returned in the order documented in the Enterprise WSDL (current alphabetical).
Punjabi Status Song (https://whatsappsongstatus.com/punjabi-status-videos)