To load Account data into Dynamics 365 using Azure Data Factory, especially when the parent account information in your CSV is stored as an account code (not a GUID), you'll need to implement a reference resolution step, as Dynamics 365 expects the GUID for lookup fields like parentaccountid
.
Here are the steps that you can try:
Load Accounts Without Parent First - Start by identifying and loading records that don’t have a parent account (i.e., root accounts).
Resolve Parent Account GUIDs - For accounts that do have a parent account code:
- Perform a Lookup in Dynamics 365 using the
account code
(you may need a custom field likenew_accountcode
in Dynamics). - Retrieve the corresponding account GUID.
Set Lookup Field in ADF - While loading the child accounts:
- Use the resolved parent account’s GUID to populate the
parentaccountid
field. - This is done using the format:
******@odata.bind = /accounts(GUID)
Optional - Use a staging area or ADF Mapping Data Flow to perform joins between your CSV and the parent account GUIDs for better control.
Load Data into Dynamics 365 - Use the Dynamics 365 connector in ADF to push the transformed data into the Account table.
Test and Validate - Run the pipeline and verify that accounts and their parent-child relationships are loaded as expected.
I hope this information helps. Please do let us know if you have any further queries.
Kindly consider upvoting the comment if the information provided is helpful. This can assist other community members in resolving similar issues.
Thank you.