When I run the following SOQL statement against the SalesForce API, it works:
SELECT ID, TYPEOF ParentRecord WHEN WorkOrder THEN Case.CaseNumber ELSE NAME END FROM ServiceAppointment
The endpoint in Postman is:
{{_endpoint}}/services/data/v{{version}}/queryAll/?q=SELECT Id, TYPEOF ParentRecord WHEN WorkOrder THEN Case.CaseNumber ELSE Name END FROM ServiceAppointment
When running that from Azure Data Factory, there is a syntax error:
SOQL error: ... syntax error near 'SELECT ID, TYPEOF ParentRecord <<< ??? >>> WHEN
Does Azure Data Factory support the TypeOf keyword for SOQL?
I tried to look for details on the error codes in specific but could not find much other than indicating server being less on RAM. However, the Salesforce connector is indeed built on REST and Bulk API, which is chosen automatically based on the data size (BULK api when result set is large) but as per your example it doesn't seem much.
Rest we can only assume as mentioned already in considerations for using TYPEOF
"
TYPEOF can’t be used in SOQL used in Bulk API
".
I would suggest you raise a support ticket or log an issue here or with Salesforce
to get an official response.
Also checkout, don’t use the Id field in a query