You need to sign in to do that
Don't have an account?
COZYROC
describeSObject for query statement
Hello Guys,
I want to ask if there is similar to describeSObject method for describing user-specified query statement. The statement will be used with the query method? If not, what is the solution in this case?
Regards,
Ivan
Hi Simon,
Thank you for the feedback! This is unfortunate. A feature like that would be necessary for better integration with third-party systems. Without it people have to built the necessary metadata manually.
One additional question. Is there a place where I could submit this feature request?
Regards,
Ivan
Thank you, Simon!
I have posted it:
Everybody who is interested in this functionality is more than welcome to vote on it.
Regards,
Ivan
Simon,
I can talk about our current situation. We have a component, which allows pulling of data from Salesforce service. The component can be then used to feed this data to a database system or to be transformed. The component exposes this data in flattened column format. We allow the user to specify either Salesforce object or SOQL statement. When the user specifies object, we use describeSObject method to retrieve its metadata and setup the data columns and data types. When the user specifies SOQL statement, we have no choice but ask the user to manually build the columns and the types based on his SOQL statement. This is the issue.
Simon,
What about if specified query returns no records? How could you get the list of fields?
Simon,
It looks like this approach is not going to work. The returned field sObject has the field name, but there is no information about the related Salesforce object.
yes, the type is per record, but the data is returned in a per record/type format, even if you query related data, this data is returned in different objects, e.g.
select name, account.name from contact
each row in the queryResult is a contact (and the .type property on the sobject will say Contact), the Account element contains a nested account object, e.g. the xml looks like
<sobjects>
<id>some ContactID</id>
<type>contact>
<name>Fred</name>
<account>
<type>account</type>
<name>Fred Inc.</name>
</account>
</sobject>
So you always know the enclosing type of a field.
Awesome! It worked like a charm. Thank you for your patience, answering my questions Simon.