Dataverse, Dual-write, Power Platform

F&O đź’™ Power Platform – Database Refresh

This is part four in a series of posts, you can find the first one here. In the dual-write projects I have been involved in, either the customer has been live on the F&O side or it has been a new implementation. Even though new implementation, the F&O side has been further ahead than Dataverse and the introduction of the dual-write synchronization.

Both cases have caused the following difficulties: UAT constantly being updated from production and dual-write settings and sync all messed up. In this post I will share what needs to be done when a db refresh is done on the F&O side and you are running dual-write with a linked Dataverse environment.

Database refresh/restore Production to UAT

Findings

  • It’s a common scenario to do a db refresh from production to test in F&O projects.
  • If dual-write is up and running, it is recommended to do it on both sides F&O and Dataverse and this works fine without an init sync afterwards.
  • If an F&O environment is overwritten (db refresh) from production and the linked Dataverse does not get restored from Dataverse production, relink and resync is needed.
  • You might get in trouble if restoring only on one side even though you do a resync.
  • You might need to delete the Dataverse data before doing the resync.
  • You might get into trouble even though you delete some of the data on the Dataverse side.

Live with F&O and Dynamics CE apps/Dataverse

This is the easy one. If you are live with both Dataverse and F&O and have production and UAT up-and-running with dual-write, then you simply do a db refresh/restore on both sides.

1. Stop dual-write table maps in UAT
2. DB refresh F&O Prod to UAT
3. DB restore Dataverse Prod to UAT
(Remember to turn off Admin mode in PPAC)
4. Dual-write “Reset Link” in F&O UAT
(Choose the correct Legal Entities)
5. Dual-write “Apply Solutions” in F&O UAT
6. Dual-write Start the table maps in F&O UAT.

Not really sure if you need 4 and 5. After the refresh/restore on both sides I checked https://{yourOwnPartOfURL}.crm4.dynamics.com/api/data/v9.1/RetrieveFinanceAndOperationsIntegrationDetails it was OK and Health Check OK. But better safe than sorry so I have done Reset Link & Apply Solutions too. I understand it from here we should do a Reset link (even though they still call it unlink there).

Live with F&O only

Now to the tricky one. Real-world scenario: No Dataverse production environment yet and that means we cannot follow the best practice and do a refresh/restore on both sides. From my experience this has been very time consuming (hence the PRE UAT set of environments). Still, at some point we will want to test dual-write also in UAT and the only thing to do then is to do what we do in the previous chapter PLUS we need to do init sync all over again.

1. Stop dual-write table maps in UAT
2. DB refresh F&O Prod to UAT
3. Dual-write “Reset Link” in F&O UAT
(Choose the correct Legal Entities)
4. Dual-write “Apply Solutions” in F&O UAT
5. Dual-write Start the table maps in F&O UAT AND Init Sync
(You might need to delete data from the Dataverse tables before a new Init Sync is done)

You can encounter sync issues due to the fact that data is out of sync F&O side and Dataverse side in UAT after a refresh from production only on one side. Meaning, either you need to get your hands dirty (read logs etc.) dig into the details, and find out what’s wrong, why won’t init sync do what I expect it to do?! Or, you will need to stop table maps, delete data on the Dataverse side and do init sync again. XrmToolBox and Bulk Data Updater will save your day!

Earlier, before we had the relink option, we also had to remove F&O records and Dataverse rows manually. Relink does that for us now. I have visited this post from Faisal Fareed, Steps to follow when refresh dual-write integrated environments (FO and CE), several times in order to remember what steps to do. Now with relink we can remove some of those steps.

Stories from when I got into trouble…

One example of when I got into trouble related to resyncing, was when I had been following the GAB (Global Address Book) templates and had been using CDS Contacts V2 in the past and now we wanted to use only Contacts V2. During init sync of Contacts V2 no contacts were added to Dataverse. We were surprised that we ended up with no rows in the contact table and wondered is it really supposed to be like that. Turned out no, it is not.

So we had removed the contacts from Dataverse, ran init sync for Contacts V2, no contacts were created. Well, we had NOT removed the rows for Contact for Customer or Vendor table. As a result the plugin which creates contacts never triggered, since it triggers when a row of “Contact for Customer or Vendor” (msdyn_contactforparties) is created. When we removed also those rows, all was good when doing init sync for Contacts V2.

Other issues I have encountered are that data has been out of sync (orphan rows without a relevant parent have been causing trouble on the Dataverse side when doing init sync), the app users used for dual-write have not been in production (F&O side) so needed to fix that in UAT after the refresh. My account (used for dual-write setup) has not been in F&O production so have had to asked for that again. Sometimes the dual-write config tables F&O and Dataverse side have not been emptied (works better now with Reset Link).

Do you have any stories to tell related to environments and db refresh? Tell me in the comments to this post!

1 thought on “F&O đź’™ Power Platform – Database Refresh”

Leave a comment