forcedotcom / SFDX-Data-Move-Utility

SFDMU is a cutting-edge Salesforce data migration tool for seamless org population from other orgs or CSV files. It handles all CRUD operations on multiple related objects in one go.
BSD 3-Clause "New" or "Revised" License
444 stars 74 forks source link

[QUESTION]-Upsert not insert when the record is not found in the target org #592

Closed nhelterbrand closed 1 year ago

nhelterbrand commented 1 year ago

Is your feature request related to a problem? Please describe. It's frustrating when your query is very specific to mention specific records in the source org, and you've already inserted those records, but since the target corresponding record isn't found via the query it's "inserted" instead of "updated". I'm wondering if there could be a feature that would treat all "inserts" like "upserts" from a database operation perspective

Describe the solution you'd like

For example, a query constructed like this in the export.json file

{
    "query": "SELECT Id, Name, External_Id__c FROM Product2 WHERE LastModifiedDate > YESTERDAY",
    "operation": "Upsert",
    "externalId": "External_Id__c"
}

where in the source org, the Product's been updated recently, but in the target org the LastModifiedDate is more in the past and thus would not also be returned in this same query. However, we're still specifying an Upsert here, so the feature would Upsert those records even though it wasn't found in the target org using the export.json's query.

Thank you! Love the tool!

hknokh commented 1 year ago

Hello,

Thank you for your message. I will review your issue as soon as possible, but please note that it may take some time to address it thoroughly. You can learn more about our support policy on our website: SFDMU support policy.

Thank you for your understanding and patience.

Best regards.

jhawk-4 commented 1 year ago

@nhelterbrand I think I'm following your scenario. Would the queryAllTarget property help you here? From the docs

True value enforces the Plugin to query ALL records from the Target org regardless limitations which are defined in the query string, i.e. it will ignore WHERE/LIMIT/OFFSET/ORDER BY clauses defined in the object's SOQL query when querying the Target org

hknokh2 commented 1 year ago

Hello! Very sorry for the long delay. You are right! queryAllTarget should do the job. Did you actually try it ? Regards.

github-actions[bot] commented 1 year ago

This case has been marked as 'to-be-closed', since it has no activity for the 3 days.
It will be automatically closed in another 3 days of inactivity.

nhelterbrand commented 1 year ago

Thank you for the response! I'll try that out