[
https://issues.apache.org/jira/browse/CAMEL-10300?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15690021#comment-15690021
]
Zoran Regvart commented on CAMEL-10300:
---------------------------------------
[~rajesh734] are you mapping the results to {{AbstractQueryRecordsBase}}
subclass in your case class like:
{code:java}
package sample;
public class AccountRecords extends AbstractQueryRecordsBase {
@XStreamImplicit
private List<Account> records;
public List<Account> getRecords() {
return records;
}
public void setRecords(List<Account> records) {
this.records = records;
}
}
{code}
{{query}} and {{queryAll}} operations use the [Salesforce REST
API|https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_query.htm]
that doesn't return {{JSON/XML}} with an array of {{SObjects}} directly but a
{{JSON/XML}} format with {{records}} property that will contain an array of
{{SObjects}}.
See this example using the {{AccountRecords}} class above:
{code:java}
AccountRecords results = template.requestBody(
"salesforce:query?sObjectClass=sample.AccountRecords&sObjectName=Account&sObjectQuery=SELECT
Id, Name, BillingStreet FROM Account",
null, AccountRecords.class);
Account firstAccount = results.records.get(0);
{code}
Also make sure that your {{Account}} class contains the properties exactly as
they are named on Salesforce. The {{camel-salesforce-maven-plugin}} can
generate those classes from the Salesforce metadata for you.
> camel-salesforce component missing salesforce fields
> ----------------------------------------------------
>
> Key: CAMEL-10300
> URL: https://issues.apache.org/jira/browse/CAMEL-10300
> Project: Camel
> Issue Type: Bug
> Components: camel-salesforce
> Affects Versions: 2.18.0
> Reporter: Rajesh A
> Assignee: Zoran Regvart
>
> All my queries using camel-salesforce component 2.18.x misses all fields
> except 'ID'.
> For example the below query should result Account objects populated with ID,
> name, company.
> Select id, name, company from Account
> But, the resultant Account objects contain only ID field populated.
> I looked the log and did debug the code, this is what I found:
> 2.18.x version uses com.fasterxml.jackson version
> where as 2.17.x uses org.codehaus.jackson version.
> com.fasterxml.jackson version parses string to Object but just includes the
> ID field and ignores other fields.
> Here is the piece of code that does this -> SalesforceConsumer.java
> // create the expected SObject
> in.setBody(OBJECT_MAPPER.readValue(
> new StringReader(sObjectString), sObjectClass));
> Please fix this.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)