Dear Camel Team,

I'm facing a bit of a show-stopper with the Camel Salesforce Component.


The SOQL query in question is:

SELECT      Account.Owner.Id,   Lookup(User)
        Account.Owner.Name, Lookup(User)
        Id,
        Name,
        Owner.Id,   Lookup(User)
        Owner.Name, Lookup(User)
        QualifyingRep__r.Name,  Lookup(User)
        Solution_Architect__r.Name, Lookup(User)
        StageName,
        Type,
        (SELECT
                Id,
                Name,
                Product2.Name,  Lookup(Product)
                Quantity,
                TotalPrice,
                UnitPrice
            FROM OpportunityLineItems
        ),
        (SELECT
                Id,
                CurrencyIsoCode,
                SplitAmount,
                SplitOwner.Id,  Lookup(User)
                SplitOwner.Name,    Lookup(User)
                SplitPercentage,
                SplitType.MasterLabel    Lookup()
            FROM OpportunitySplits
        )
    FROM Opportunity
    WHERE StageName = 'Closed Won'

I have added 'Lookup()' to annotate the 'minor' relationship where these exist.


The JSON returned looks like:

{
    "attributes": {
        "referenceId": null,
        "type": "Opportunity",
        "url": "/services/data/v49.0/sobjects/Opportunity/<guid>"
    },
    "Type": "New Revenue",
    "StageName": "Closed Won",
    "Account": {
        "attributes": {
            "referenceId": null,
            "type": "Account",
            "url": "/services/data/v49.0/sobjects/Account/<guid>"
        }
    },
    "OpportunityLineItems": {
        "done": true,
        "totalSize": 5,
        "nextRecordsUrl": null,
        "records": [
            {
                "attributes": {
                    "referenceId": null,
                    "type": "OpportunityLineItem",
                    "url": 
"/services/data/v49.0/sobjects/OpportunityLineItem/<guid>"
                },
                "Quantity": 1.0,
                "UnitPrice": 11990.0,
                "TotalPrice": 11990.0,
                "Name": "XXXXXXXXXXXXXXXXXXXXXX YYYYYYYYYYYYY",
                "Id": "<guid>"
            },
            {
                "attributes": {
                    "referenceId": null,
                    "type": "OpportunityLineItem",
                    "url": 
"/services/data/v49.0/sobjects/OpportunityLineItem/<guid>"
                },
                "CurrencyIsoCode": "USD",
                "Quantity": 1.0,
                "UnitPrice": 2758.0,
                "TotalPrice": 2758.0,
                "Name": "XXXXXXXXXXXXXXXXXXXXXX ZZZZZZZZZZZZZZ",
                "Id": "<guid>"
            }
        ]
    },
    "OpportunitySplits": {
        "done": true,
        "totalSize": 2,
        "nextRecordsUrl": null,
        "records": [
            {
                "attributes": {
                    "referenceId": null,
                    "type": "OpportunitySplit",
                    "url": 
"/services/data/v49.0/sobjects/OpportunitySplit/<guid>"
                },
                "CurrencyIsoCode": "USD",
                "SplitPercentage": 100.0,
                "SplitAmount": 23392.0,
                "Id": "<guid>"
            },
            {
                "attributes": {
                    "referenceId": null,
                    "type": "OpportunitySplit",
                    "url": 
"/services/data/v49.0/sobjects/OpportunitySplit/<guid>"
                },
                "CurrencyIsoCode": "USD",
                "SplitPercentage": 0.0,
                "SplitAmount": 0.0,
                "Id": "<guid>"
            }
        ]
    },
    "Name": "XXXXXXXXXXXXXXXXXXXXXX",
    "Id": "<guid>"
}


The query output should be scattered with names but not a single one is 
returned. This is a show-stopper because the purpose of the integration is to 
calculate commissions (we need to know who to pay!).


In fact, none of the child-to-parent relationship values are returnd. SOQL 
supports up to 
5<https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_relationships_query_limits.htm>
 nested child-to-parent relationships, so the query is well within limits.

Only the values for directly referenced fields are returned, like Opportunity 
Credit_Card_Payment__c, Distributor_Discount__c, Id, Invoice_2014__c, or Name. 
It looks like anything with a parent dot notation is simply ignored.

The Workbench REST API 
browser<https://workbench.developerforce.com/restExplorer.php> shows all the 
relationships clearly defined as does the SF Schema 
Builder<https://parasoft.lightning.force.com/one/one.app#eyJjb21wb25lbnREZWYiOiJvbmU6YWxvaGFQYWdlIiwiYXR0cmlidXRlcyI6eyJhZGRyZXNzIjoiL191aS9wbGF0Zm9ybS9zY2hlbWEvdWkvc2NoZW1hYnVpbGRlci9TY2hlbWFCdWlsZGVyVWkifSwic3RhdGUiOnt9fQ%3D%3D>.


A similar thing occurs with the camel-salesforce-maven-plugin when generating 
the DTOs - the relationships are not generated. In fact, this is where I first 
noticed the problem. Instead of Opportunity.Account.OwnerId returning a User 
object, it returns a String. This would be OK of there was a corresponding 
Opportunity.Account.Owner returning a User. I point this out because 
Opportunity DTO has both Account and AccountId returning an Account object and 
a String respectively.


I am migrating away from Jitterbit, which I believe uses the Salesforce SOAP 
API. All the relationships defined in Salesforce are available to Jitterbit, so 
I'm puzzled by what's happening in the Camel Salesforce Component & Plugin.


Is there something I need to do to have all the relationships generated in the 
DTOs, and of course for the query to return everything requested?


These are the versions I'm using from the pom:


<properties>
<java.version>11</java.version>
<camel.version>3.4.2</camel.version>
<maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
<maven-surefire-plugin.version>3.0.0-M5</maven-surefire-plugin.version>
<spring-boot.version>2.3.0.RELEASE</spring-boot.version>
<!-- Salesforce Rest API version -->
<camel-sfdc.apiVersion>49.0</camel-sfdc.apiVersion>
</properties>

I have also raised this question on Stack 
Overflow<https://stackoverflow.com/questions/63413718/apache-camel-salesforce-component-are-minor-relationships-supported>.


Thanks in advance for your help.



Sincerely,

Jean-Marc Reynaud

Reply via email to