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

[QUESTION] - External-Id based on Name and SetupOwnerId$Profile for CustomSetting #903

Closed
Schuchie opened this issue Oct 8, 2024 · 9 comments
Assignees
Labels
completed The issue was successfully resolved/Feature is completed help-wanted User need a help or something not working, not a bug kb Need to put it to the Knowledge Base

Comments

@Schuchie
Copy link

Schuchie commented Oct 8, 2024

Hey!

We are trying to migration Custom Settings. Custom Settings have always as SetupOwner. Which can be an Org or Profile. For our case we have Profiles only and we have used the Polymorphic Field as followed SetupOwnerId$Profile. Sadly we do not have a real unique field on our object. Also the Name of the settings is not fully unique. So is there an Option to use a combination of SetupOwnerId$Profile and the Name-Field as External-Id? That would be 100% unique, but Im unsure if that gets handled correctly.

Cheers
Nils

@Schuchie Schuchie added the help-wanted User need a help or something not working, not a bug label Oct 8, 2024
@Schuchie Schuchie changed the title [QUESTION] - Replace this placeholder with a specific title for the issue. Do not delete "[QUESTION]" . [QUESTION] - External-Id based on Name and SetupOwnerId$Profile for CustomSetting Oct 8, 2024
@hknokh
Copy link
Collaborator

hknokh commented Oct 8, 2024

Hello, @Schuchie

Thank you for reaching out.
I will do my best to assist you as quickly as possible and will keep you updated on my progress.

Cheers

@Schuchie
Copy link
Author

Hey @hknokh,
any update?
Cheers
Nils

@hknokh
Copy link
Collaborator

hknokh commented Oct 11, 2024

Hello
Try to use Name;SetupOwner.Name as an external id for the CustomSettings objects.
Regards.

@hknokh hknokh added kb Need to put it to the Knowledge Base in-progress Issue is currently in the resolution progress labels Oct 11, 2024
@Schuchie
Copy link
Author

Schuchie commented Oct 14, 2024

Hey @hknokh,
that behaves a little bit strange. When I'm adding this to the export.json and exporting from the org I would expect the SetupOwner.Name be pulled into the column external-column, but thats not happing:

{
            "query": "SELECT id, Name,SetupOwner.Name, SetupOwnerId$Profile FROM clm__TopLvlObjects__c",
            "operation": "Upsert",
            "externalId": "Name;SetupOwner.Name"
        },

I only get the name-value,but not the setupowner-name-value. 2 of the selected records have a profile attached and one has the org as setup owner.

Query Result:

"_","Id","Name","SetupOwner","SetupOwner.Name","SetupOwnerId"
"[clm__TopLvlObjects__c]","a0s9Q0000019jIHQAY","Menu Settings and Offline Objects (Organisation)","[Name]","Company","00D7Z0000004uqnUAA"
"[clm__TopLvlObjects__c]","a0s9Q0000019jIIQAY","Menu Settings and Offline Objects (Profile)","[Name]","KAD Minimal Access","00e7Z000000cfC7QAI"
"[clm__TopLvlObjects__c]","a0s9Q0000019jIJQAY","Menu Settings and Offline Objects (Profile)","[Name]","WAD Minimal Access","00e7Z000000cfCMQAY"

FYI: For the org setting, Im replacing it with null on retrieve, which then will be replaced by salesforce on upsert automatically with the org-id.

@Schuchie
Copy link
Author

@hknokh any update?

@Schuchie
Copy link
Author

bump @hknokh

@hknokh2
Copy link
Contributor

hknokh2 commented Oct 29, 2024

Hello.
Query string for objects dies not accept referenced fields separated by dot, like SetupIwner.Name, only the fields which are directly owned by the queried object.
That is why such field will not be finally exported.
When you use complex external id the values from both fields are internally converted and merged in memory into a single field in a special format and used to compare records, but still not exported or elsehow affected the target org.
Cheers

@hknokh
Copy link
Collaborator

hknokh commented Nov 4, 2024

Hello.

This case is now considered resolved, and I am closing it for now. If you have any additional questions or concerns, please don't hesitate to reach out.

Regards.

@hknokh hknokh closed this as completed Nov 4, 2024
@hknokh hknokh added completed The issue was successfully resolved/Feature is completed and removed in-progress Issue is currently in the resolution progress labels Nov 4, 2024
@Schuchie
Copy link
Author

Schuchie commented Nov 5, 2024

Hey @hknokh,

I think there is still something not working correctly.
I've the following record setup and it still fails on the second upsert. SFDMU still tries to insert the second record. The first one gets upserted correctly.
image

Cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
completed The issue was successfully resolved/Feature is completed help-wanted User need a help or something not working, not a bug kb Need to put it to the Knowledge Base
Projects
None yet
Development

No branches or pull requests

3 participants