Wednesday, August 21, 2019

D365FO - BYODB Entity Export Failing with no error message (Catch Weight Exporting Issue)


Recently after standing up a new export and going to export the Sales order lines V2 and Purchase order lines V2 entity's to a Azure SQL DB it started to fail. However in the execution log there is no error





If you try running it in batch mode the batch completes but nothing is export but the export shows as completed.


If you dig into event viewer on the server under

Application and Services Logs > Microsoft > Dynamics > AX-DIXFRuntime > Operational

You will find your error but it is very generic and does not give you any helpful information just that entity is crashing







Error:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Exception: Exception from HRESULT: 0xC0202009 at Microsoft.Dynamics.AX.Framework.Tools.DMF.ServiceProxy.DmfEntitySharedTypesProxy.DoWork[T](Func`1 work) --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams) at Microsoft.Dynamics.Ax.Xpp.CLRInterop.MakeReflectionCall(Object instance, String methodName, Object[] parameters)



After trying multiple ways of regenerating the mapping, refreshing the entity list, builds, db syncs I was still getting the error.

However I deleted all fields within the mapping and just did a few base fields the entity index is based on and found that the entity would export. Because of this I knew that something was wrong with one of the field mappings.


After regenerating the complete list and started to remove fields in order to see if it would work I was able to find the specific fields that were cause the issue.

ORDEREDCATCHWEIGHTQUANTITY


Currently we have Catch Weight enabled within the configuration key but are not using this feature as we are still in the design phase of our implementation


If we have an entity that is failing export and it is a base export one thing to do is whenever defining the mapping or the scheme do a search for "catch" and remove it from the mapping (in data project assignment or main modify target mapping) or  the export will now work. It does not matter if the fields get published to the scheme it only matters if these catch weight fields get included in the export.



Update 9/26/19: It turns out that disabling the catchweight key does not stop the field from being added to the entity mapping.