D365FO Dual-Write Initial Sync: Error Handling
Recently I started building some app using Microsoft PowerApps and I noticed that I’m missing some D365FO tables in Dataverse. In this post, I will show you how to properly run the D365FO Dual-Write Initial Sync, and how to solve some common issues. I will not explain how to connect D365FO with Dataverse, or how to set up Dual-write, since this is explained on the following pages:
NOTE: I know that Microsoft’s documentation sucks, so feel free to add your comments if you need any help with Dataverse/Dual-Write setup. You can also contact me here.
D365FO Dual-Write Initial Sync
In order to add a table to Dataverse, you must start with the initial sync first. Go to System administration > Workspaces > Data management and click on Dual-write:
Make sure you check for which legal entities the Dual-write is enabled. Click on Environment details:
Add missing legal entities if needed:
Select the table you would like to add, and click on Run:
Dual-Write Error Handling
If you will see some errors, select the table and click on Initial sync details:
If you see this kind of error, this usually means that you are missing a related table (subtable) in Dataverse:
Couldn't resolve the guid for the field: msdyn_paymentterms.msdyn_name.
The lookup value was not found: N0. Lookup parententity: msdyn_paymentterms,
lookup result: .. Try this URL(s) to check if the reference data exists:
https://xxxxxxx.crm4.dynamics.com/api/data/v9.0/
msdyn_paymentterms?$select=msdyn_name,msdyn_paymenttermid&$filter=msdyn_name eq 'N0'
Go back, and add the missing table. Then try to start the initial sync for your table again. You can see the related table by choosing the following option:
Mark all the related tables and run the initial sync again:
Sometimes, you will get this kind of error:
Reason: Bad Request, Header x-ms-client-request-id ffc46319-cdec-4f22-aba7-dad436e49425,
Error identified in Payload provided by the user for Entity :'msdyn_vendors',
For more information on this error please follow this help link https://go.microsoft.com/fwlink/?linkid=2195293 ----> InnerException : Microsoft.OData.ODataException:
Cannot convert the literal 'ro-RO' to the expected type 'Edm.Int32'. --->
System.FormatException: Input string was not in a correct format. at System.Number.StringToNumber(String str, NumberStyles options,
NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
at System.String.System.IConvertible.ToInt32(IFormatProvider provider)
at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider
provider) at Microsoft.OData.ODataPayloadValueConverter.ConvertStringValue
(String stringValue, Type targetType) at
Microsoft.OData.ODataPayloadValueConverter.ConvertFromPayloadValue(
Object value, IEdmTypeReference edmTypeReference) --- End of inner
exception stack trace --- at
Microsoft.OData.ODataPayloadValueConverter.ConvertFromPayloadValue(
Object value, IEdmTypeReference edmTypeReference) at
Microsoft.Crm.Extensibility.ODataV4.CrmPrimitivePayloadValueConverter
.ConvertFromPayloadValue(Object value, IEdmTypeReference edmTypeReference)
at Microsoft.OData.JsonLight.ODataJsonLightReaderUtils.ConvertValue(Object
value, IEdmPrimitiveTypeReference primitiveTypeReference,
ODataMessageReaderSettings messageReaderSettings, Boolean validateNullValue,
String propertyName, ODataPayloadValueConverter converter) at Microsoft.OData.JsonLight.ODataJsonLightPropertyAndValueDeserializer.ReadPrimitiveValue(
Boolean insideJsonObjectValue, IEdmPrimitiveTypeReference expectedValueTypeReference,
Boolean validateNullValue, String propertyName) at
Microsoft.OData.JsonLight.ODataJsonLightPropertyAndValueDeserializer.
ReadNonEntityValueImplementation(String payloadTypeName, IEdmTypeReference
expectedTypeReference, PropertyAndAnnotationCollector propertyAndAnnotationCollector,
CollectionWithoutExpectedTypeValidator collectionValidator, Boolean validateNullValue,
Boolean isTopLevelPropertyValue, Boolean insideResourceValue, String propertyName,
Nullable`1 isDynamicProperty) at Microsoft.OData.JsonLight.ODataJsonLightResourceDeserializer.ReadEntryDataProperty(
IODataJsonLightReaderResourceState resourceState, IEdmProperty edmProperty, String propertyTypeName) at
Microsoft.OData.JsonLight.ODataJsonLightResourceDeserializer.ReadPropertyWithValue(
IODataJsonLightReaderResourceState resourceState, String propertyName, Boolean isDeltaResourceSet) at Microsoft.OData.JsonLight.ODataJsonLightResourceDeserializer.<>
c__DisplayClass9_0.<ReadResourceContent>b__0(PropertyParsingResult propertyParsingResult, String propertyName) at
Microsoft.OData.JsonLight.ODataJsonLightDeserializer.ProcessProperty(
PropertyAndAnnotationCollector propertyAndAnnotationCollector,
Func`2 readPropertyAnnotationValue, Action`2 handleProperty) at
Microsoft.OData.JsonLight.ODataJsonLightResourceDeserializer.ReadResourceContent(
IODataJsonLightReaderResourceState resourceState) at
Microsoft.OData.JsonLight.ODataJsonLightReader.StartReadingResource() at
Microsoft.OData.JsonLight.ODataJsonLightReader.ReadResourceSetItemStart(
PropertyAndAnnotationCollector propertyAndAnnotationCollector,
SelectedPropertiesNode selectedProperties) at
Microsoft.OData.JsonLight.ODataJsonLightReader.ReadAtStartImplementationSynchronously(
PropertyAndAnnotationCollector propertyAndAnnotationCollector) at
Microsoft.OData.ODataReaderCore.ReadImplementation() at
Microsoft.OData.ODataReaderCore.InterceptException[T](Func`1 action) at
System.Web.OData.Formatter.Deserialization.ODataReaderExtensions.ReadResourceOrResourceSet(
ODataReader reader) at
Microsoft.Crm.Extensibility.CrmODataEntityDeserializer.Read(
ODataMessageReader messageReader, Type type,
ODataDeserializerContext readContext) at System.Web.OData.Formatter.ODataMediaTypeFormatter.ReadFromStream(
Type type, Stream readStream, HttpContent content, IFormatterLogger formatterLogger).
Based on the error message, it looks like the system is trying to put value ‘ro-RO’ into integer field in Dataverse:
You can see the same when you check the Table mappings:
It seems that mapping exists, but the mapping for value ‘ro-RO’ is missing:
If you don’t need the field in Dataverse, you can remove the field mapping, and run the initial sync again.
If you are removing the mapping, make sure you save the new table mapping:
In this specific case, I didn’t delete the mapping. Instead, I ran the sync for the following table:
Now the following error appeared:
Type=Microsoft.Dynamics.Integrator.Exceptions.IntegratorClientException,
Msg=Type=Microsoft.Dynamics.Integrator.Exceptions.IntegratorClientException,
Msg=FinOps export encountered an error.
(Type=Microsoft.Dynamics.Integrator.Exceptions.IntegratorClientException,
Msg=Export failed, Please check execution for project DWM-
e2ac0208-7f18-41fd-9603601ff66dc2c4db397a4a4a490d5f6ba_0 and execution id
ExportPackage-12/18/2024 8:32:19 AM-2d978df1-e287-4eea-9a6b-8b02a644763e
in FnO. Error details Type=Microsoft.Dynamics.Integrator.Exceptions.
IntegratorClientException, Msg=F&O export encountered an error.
Please check project and execution ExportPackage-12/18/2024 8:32:19 AM-2d978df1-
e287-4eea-9a6b-8b02a644763e in F&O)
When I check the execution of this package in Data management, I see the error below:
[Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Change tracking is not enabled
on table 'LOGISTICSLOCATION'.
I tried to enable sync of the Warehouse locations, but I’m getting the Project validation failed
error:
I tried to map the fields manually:
But I received the following error:
Warehouse locations (msdyn_inventorylocations) : Project validation failed. [DIPV1015] Mapping is incomplete - Integration key field(s) [msdyn_warehouseaisle.msdyn_warehouse.msdyn_company(Warehouse (Company))] from table [msdyn_warehouseaisles(Warehouse Aisle)] must be mapped.
I tried to enable the sync for the following table:
After the initial sync ended, the sync of Warehouse locations (msdyn_inventorylocations) started without the previous error:
The error was still there, so I enabled change tracking on LogisticsPostalAddressLocationCDSEntity (Enable entire entity):
I tried to sync Vendors V2 (msdyn_vendors) again and it finally worked:
Conclusion
In conclusion, mastering the D365FO Dual-Write Initial Sync is no small feat. Dual-write is a powerful tool, but it’s not without its challenges. From ensuring accurate synchronization to navigating dual-write error handling, the process requires time, patience, and meticulous attention to detail. It’s not always easy, and anyone tackling dual-write should be prepared to invest significant effort, and maybe even steel their nerves! With proper preparation and the right approach, however, you can ensure a smoother integration between D365FO and Dataverse. Stay persistent, and you’ll get there!