Party relationship types Database Sync Issue
If you have requirement to extend the DirSystemRelationshipType enum. So be ready to get DB synchronization issue on your Azure UAT and DEV-TEST environment.
You will get the below error on run-book, If you don't perform the pre-requisite step before deploying the package.
Application configuration sync failed. Microsoft.Dynamics.AX.Framework.Database.TableSyncException: Custom action sync failed with error: 'NullReferenceException:Object reference not set to an instance of an object.
at Dynamics.AX.Application.DirRelationshipTypeTable.initFromSystemRelationshipType(DirSystemRelationshipType _systemType) in xppSource://Source/Directory\AxTable_DirRelationshipTypeTable.xpp:line 8
at Dynamics.AX.Application.DirDataPopulation.insertDirRelationshipTypes() in xppSource://Source/Directory\AxClass_DirDataPopulation.xpp:line 265
at Dynamics.AX.Application.DirDataPopulation.populateDirData() in xppSource://Source/Directory\AxClass_DirDataPopulation.xpp:line 628
at Dynamics.AX.Application.DirSetup.loadData() in xppSource://Source/Directory\AxClass_DirSetup.xpp:line 34
at Dynamics.AX.Application.DirSetup.numberSequenceModuleSetupLoadDataHandler() in xppSource://Source/Directory\AxClass_DirSetup.xpp:line 45
at Dynamics.AX.Application.NumberSequenceModuleSetup.loadData() in xppSource://Source/ApplicationFoundation\AxClass_NumberSequenceModuleSetup.xpp:line 21
at Microsoft.Dynamics.AX.Deployment.Setup.AppOperations.NumberSequenceSetup()
at Microsoft.Dynamics.AX.Framework.Database.Tools.LegacyCodepath.<>c__DisplayClass28_0.<RunCustomAction>b__0()
at Microsoft.Dynamics.AX.Framework.Database.Tools.LegacyCodepath.ExecuteWithinAOS(SyncOptions syncOptions, String sqlConnectionString, IMetadataProvider metadataProvider, Func`1 func, Action`1 errorHandler)' ---> System.NullReferenceException: Object reference not set to an instance of an object.
at Dynamics.AX.Application.DirRelationshipTypeTable.initFromSystemRelationshipType(DirSystemRelationshipType _systemType) in xppSource://Source/Directory\AxTable_DirRelationshipTypeTable.xpp:line 8
at Dynamics.AX.Application.DirDataPopulation.insertDirRelationshipTypes() in xppSource://Source/Directory\AxClass_DirDataPopulation.xpp:line 265
at Dynamics.AX.Application.DirDataPopulation.populateDirData() in xppSource://Source/Directory\AxClass_DirDataPopulation.xpp:line 628
at Dynamics.AX.Application.DirSetup.loadData() in xppSource://Source/Directory\AxClass_DirSetup.xpp:line 34
at Dynamics.AX.Application.DirSetup.numberSequenceModuleSetupLoadDataHandler() in xppSource://Source/Directory\AxClass_DirSetup.xpp:line 45
at Dynamics.AX.Application.NumberSequenceModuleSetup.loadData() in xppSource://Source/ApplicationFoundation\AxClass_NumberSequenceModuleSetup.xpp:line 21
at Microsoft.Dynamics.AX.Deployment.Setup.AppOperations.NumberSequenceSetup()
at Microsoft.Dynamics.AX.Framework.Database.Tools.LegacyCodepath.<>c__DisplayClass28_0.<RunCustomAction>b__0()
at Microsoft.Dynamics.AX.Framework.Database.Tools.LegacyCodepath.ExecuteWithinAOS(SyncOptions syncOptions, String sqlConnectionString, IMetadataProvider metadataProvider, Func`1 func, Action`1 errorHandler)
--- End of inner exception stack trace ---
at Microsoft.Dynamics.AX.Framework.Database.Tools.LegacyCodepath.<>c.<RunCustomAction>b__28_1(Tuple`2 result)
at Microsoft.Dynamics.AX.Framework.Database.Tools.LegacyCodepath.ExecuteWithinAOS(SyncOptions syncOptions, String sqlConnectionString, IMetadataProvider metadataProvider, Func`1 func, Action`1 errorHandler)
at Microsoft.Dynamics.AX.Framework.Database.Tools.LegacyCodepath.RunCustomAction(SyncOptions syncOptions, String sqlConnectionString, IMetadataProvider metadataProvider, Action`1 a)
at Microsoft.Dynamics.AX.Framework.Database.Tools.SyncEngine.PostTableSync()
at Microsoft.Dynamics.AX.Framework.Database.Tools.SyncEngine.FullSync()
at Microsoft.Dynamics.AX.Framework.Database.Tools.SyncEngine.RunSync(SyncOptions options)
at Microsoft.Dynamics.AX.Framework.Database.Tools.SyncEngine.Run(String metadataDirectory, String sqlConnectionString, SyncOptions options)
11/28/2017 18:37:51: The operation failed.
This step work manually in VS and fails during the deployment is because during the deployment the system will run some extra steps different than the simple DBSync in VS. For instance, the system is here trying to set up the Number Sequences and it is kind of failing in the Dynamics.AX.Application.DirRelationshipTypeTable.initFromSystemRelationshipType(DirSystemRelationshipType _systemType) in xppSource://Source/Directory\AxTable_DirRelationshipTypeTable.xpp:line 8
So, it could be that you are missing any reference here, or your package does not include any reference model. If you create a runnable class in your development box and run NumberSequenceModuleSetup.loadData()
Resolution
First search the DirSystemRelationshipType in AOT and identify the extended elements.In my case, We only added one element Named > Friend. You can the below screenshot.
There is two way to fix the issue.
- 1st-way
Go to organization Administration > Organization > Relationship type
Now add the elements you added in extended enum and you identified in our above steps. In my Case we Added only One element Friend So create new record in relationship type list page. pleae check the screenshot.
End of first way to fix the issue. for the verification you can sync the DB using power shell.
In the below i have explained how to full sync database using power shell.
- 2nd-way
First find the class in AOT DirRelationshipTypeChildInitialize and copy paste the complete content in new class like the below screenshot and replace the highlighted elements.
- 1st highlighted section I replaced from Child to Friend
- 2nd highlighted section I replaced from DirPartyType::Person to DirPartyType::None
- 3rd highlighted section I replaced with my label.
After all of above steps build the model and for testing purpose to populating the new relationship type, you can create a runnable class, and call DirDataPopulation::insertDirRelationshipTypes() in Main(). You should see the new relationship type in the DirRelationshipTypeTable, and the new relationship type will be available on the Relationship types page.
You can also verify by execute the DB Sync with Power Shall
In the below i have explained how to full sync database using power shell.
I have execute the same and result found as expected. check the below screen shots.










Tidak ada komentar:
Posting Komentar