Row Count Difference between the Web and Copy activity using Salesforce V2 connector

Manjeet Acharya 20 Reputation points
2025-08-06T22:06:12.16+00:00

Hi! I am using the Salesforce V2 connector to extract data from my salesforce account. When I use the Copy activity, I get around 1200 rows for a certain object. And when I use the Web activity to pass a query that does a Count of Id from that same object, the row count is different. Does anyone know why this happens? Is there a better way to get a row count of the object using the salesforce V2 connector?

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

1 answer

Sort by: Most helpful
  1. Vinodh247 36,031 Reputation points MVP Volunteer Moderator
    2025-08-07T00:50:14.44+00:00

    Hi ,

    Thanks for reaching out to Microsoft Q&A.

    The Copy activity using Salesforce V2 may implicitly filter records:

    • Only Active records (i.e., IsDeleted = false) may be included.
    • SystemModStamp or LastModifiedDate filtering is applied if incremental loading is enabled.
    • Some lookup or relationship objects behave differently when queried via Copy activity. You can check for any default or explicit filters set in the Source settings or mapping.

    Query Scope in SOQL (Web Activity)

    Your SOQL query in Web activity might be --> SELECT COUNT(Id) FROM Account

    This counts all visible records to the user running the query, which could include:

    Archived or deleted records (in Recycle Bin)

    Records that do not meet Copy activity's internal filters

    Records that are accessible only due to sharing rules or admin privileges

    Try adding a WHERE IsDeleted = FALSE to your SOQL to match Copy activity behavior more closely --> SELECT COUNT(Id) FROM Account WHERE IsDeleted = FALSE

    Copy Activity May Omit Certain Records

    Depending on the object type (standard vs custom), API version, and selected fields, Copy activity may skip:

    Records with nulls in required fields

    Unreachable fields due to field-level security

    Fields requiring special permissions (e.g., formula fields, lookup fields)

    API Limitations and Pagination

    Salesforce imposes batch limits (default 2000 records per batch), and ADF handles this with pagination internally. If the Copy activity:

    • Hits a timeout or fails to paginate completely (rare)
    • Has a schema mismatch
    • Is using SOQL with LIMIT or WHERE conditions ->this may return few records

    Best method to Get Accurate Row Count with Salesforce V2 Connector:

    To align your row counts:

    1. Use the Web activity with filtered SOQL -> SELECT COUNT(Id) FROM Account WHERE IsDeleted = FALSE
    2. Alternatively, use a Copy activity with a derived column (ex:RowNumber) and then aggregate using Data Flow, but this is less efficient.

    Enable logging and diagnostics on both activities and check:

    Exact query being executed

      Any skipped rows due to schema mapping or errors
      
      Use Salesforce Workbench or Developer Console to validate expected count independently.
      
    

    Please 'Upvote'(Thumbs-up) and 'Accept' as answer if the reply was helpful. This will be benefitting other community members who face the same issue.


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.