How can we automatically get the Salesforce newly inserted data set after copy activity in ADF

Umair Ehsan 20 Reputation points
2025-06-13T09:35:34.91+00:00

Essentially, I am trying to copy data from an Azure SQL server to Salesforce using Azure Data Factory (ADF). How can we automatically get the Salesforce newly inserted dataset after the copy activity in ADF?

User's image

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

Accepted answer
  1. Venkat Reddy Navari 3,125 Reputation points Microsoft External Staff Moderator
    2025-06-16T09:48:54.0866667+00:00

    @Umair Ehsan Since you're writing data from Azure SQL into Salesforce using ADF and then want to fetch those newly inserted records (along with their Salesforce-generated IDs) right after the insert, here’s a practical approach you can try within the same pipeline:

    Use an External ID – When pushing data into Salesforce, it helps if you're passing a unique value from your SQL source (like a primary key). This can be used later to identify exactly what was inserted.

    Add a Follow-up Lookup or Copy Activity – After the insert step, add a step that queries Salesforce (using SOQL) to pull back those same records based on the external IDs. This way, you can get the Salesforce record IDs and any other fields you need. Something like:

    
    Copy
    SELECT Id, External_Id__c FROM YourObject WHERE External_Id__c IN ('your-key-values')
    

    Optional: Store or log these records – You can store the results in a SQL or blob sink, especially if you need them for backfill or reconciliation later.

    If your load volume is high, instead of directly using external IDs, you can implement a watermark pattern based on CreatedDate, filtering records inserted in the last few minutes (e.g., CreatedDate >= @{pipeline().TriggerTime} minus buffer).


    Hope this helps. If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.

    2 people found this answer helpful.

0 additional answers

Sort by: Most helpful

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.