Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] - Linking records in a 2-way lookup (one-to-one) #576

Closed
vmjelde opened this issue Mar 9, 2023 · 6 comments
Closed

[BUG] - Linking records in a 2-way lookup (one-to-one) #576

vmjelde opened this issue Mar 9, 2023 · 6 comments
Assignees
Labels
bug Something isn't working, looks like a bug completed The issue was successfully resolved/Feature is completed

Comments

@vmjelde
Copy link

vmjelde commented Mar 9, 2023

We have 2 objects with a lookup field to eachother:

  • Object: CartItem, field: Application__c
  • Object: Application__c, field: CartItem__c

How can we insert CartItems and Application with both these fields populated?
Can we run insert CartItem, Insert Application, update Cart Item? Or does sfdmu check two-way-lookups (dependencies) and handles it?

@vmjelde vmjelde added the help-wanted User need a help or something not working, not a bug label Mar 9, 2023
@hknokh
Copy link
Collaborator

hknokh commented Mar 9, 2023

Hello,
You can simply put to Insert the both objects.
Typically the sfdmu handles 2 way dependencies ootb

@hknokh hknokh added the in-progress Issue is currently in the resolution progress label Mar 9, 2023
@vmjelde
Copy link
Author

vmjelde commented Mar 9, 2023

Hello,
Thank you for quick response.

It's great that sfdmu handles 2 way dependencies ootb, but do you have some guidance for it? I tried with two custom objects, but got "Missing expected parent ExternalID value".
See attached .zip for the dataset and logs.

test-data.zip

@hknokh2
Copy link
Contributor

hknokh2 commented May 1, 2023

Hello,

Sorry for the delay. I'm still investigating this issue. However, one thing I can say is that for the Upsert operation, you need to specify the name of the external ID field in the export.json file for the object. Additionally, you should include a column in the CSV file for the external ID field value. Otherwise, the plugin will not be able to bind the objects.

For the Insert operation, setting the Id field as the external ID is sufficient. If you set the operation to Insert instead of Upsert, your export.json should work.

I will need to confirm whether this works for the CSV file as well and whether there are any bugs. I will update you as soon as I have more information.

hknokh added a commit that referenced this issue May 1, 2023
fix: Fixed circular references handling (#576)
@hknokh2
Copy link
Contributor

hknokh2 commented May 1, 2023

@vmjelde
There was a bug of handling circular references, which is fixed.
Please update the Plugin.
Also see the new article regarding your example:
https://help.sfdmu.com/examples/configuration/basic-examples

Note, that it is not possible to upsert or update records using the same CSV files since you would need to set the external ID field in the export JSON file and provide explicit external ID values for each record, which would require different CSV files.
Therefore, for your use case, it is recommended to use Insert instead of Upsert in the export.json.

@hknokh hknokh added completed The issue was successfully resolved/Feature is completed bug Something isn't working, looks like a bug and removed in-progress Issue is currently in the resolution progress help-wanted User need a help or something not working, not a bug labels May 1, 2023
@hknokh hknokh changed the title [QUESTION] - Linking records in a 2-way lookup (one-to-one) [BUG] - Linking records in a 2-way lookup (one-to-one) May 1, 2023
@github-actions
Copy link

github-actions bot commented May 5, 2023

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.

@github-actions github-actions bot added the to-be-closed The issue is about to be closed label May 5, 2023
@github-actions
Copy link

github-actions bot commented May 8, 2023

This case has been closed, since it has no activity for the last 6 days. Feel free to reopen it, if you need more help.

@github-actions github-actions bot closed this as completed May 8, 2023
@github-actions github-actions bot removed the to-be-closed The issue is about to be closed label Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working, looks like a bug completed The issue was successfully resolved/Feature is completed
Projects
None yet
Development

No branches or pull requests

3 participants