Am migrating an existing Mule 3 api that interacts with Salesforce.
In mule 3 we are using Query Single
as below:
<sfdc:query-single config-ref="XYZ" query="dsql:SELECT abc blah blah" doc:name="GET Customer Details Query"/>
While in Mule 4 I dont see an equivalent of Query Single
Where do I get Query Single
in case of Mule 4 ?
At the moment am using Query
in Mule 4
<salesforce:query doc:name="Query" config-ref="Salesforce_Connector">
<salesforce:salesforce-query ><![CDATA[#[ SELECT abc blah blah ]]]></salesforce:salesforce-query>
</salesforce:query>
As a result in case of Mule 3 the response is an Object Vs In Mule 4 an array : Mule 3 response:
{
"Id":null,
"type":"XYZ__c",
"ABCNumber__c":"123456789"
}
Mule 4 response:
[
{
"Id":null,
"type":"XYZ__c",
"ABCNumber__c":"123456789"
}
]
While I can choose to select the first element of array , I would prefer if I could use Query Single
if it was available in Mule 4 ?
Google search is not really providing any details ....
so was wondering if Query Single
for SFDC is available in Mule 4 ?
If not what is the best approach ?
Taking the first element if it exists is a right way to use Salesforce query in Mule 4. Since there is no Query Single operation you should take the first element, if it exists. Having said that the Query operation is deprecated since the 10.13 release of the Salesforce Connector and you should use the Query XML Stream operation instead.