Migrating ADF to Salesforce v2 Dataset, how to get MAX() value of Object's LastModifiedDate

Maarten 0 Reputation points
2024-09-19T12:00:34.33+00:00

Hello,

I'm migrating to the new Salesforce v2 linked service and dataset. We have a dynamic set up to load the delta from Salesforce into our SQL Server DWH every night. We loop over all Objects that we sync, and start off with executing this statement in a Lookup activity, e.g.

SELECT MAX(LastModifiedDate) delta_attribute_max_value FROM Contact

The next steps are to load all data of which the LastModifiedDate is between the previous succesful run's, and this fetched value, and upsert the records. Thankfully our queries for the Copy Data activity were already SOQL. However, the above statement is no longer possible.

Screenshot ADF Lookup with Salesforce

How to proceed? According to this article, I can no longer perform an aggregate function, nor do an order by desc and fetch the top row.

I'd rather not create 50 reports in Salesforce that contain the max LastModifiedDate for each object. Is there another way?

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
10,843 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.