SBX - Search With Button

SBX - Forum Post Title

DataEntity extension & Table inheritance & Data Import -> Null Reference Exception in SysDataEntityPersister

Dynamics 365 for Finance and Operations Forum

Pete Alberts asked a question on 6 Jun 2019 3:26 AM
My Badges

Question Status

Verified

Customer import with CustCustomerV3Entity fails in some cases with a classic "Object reference not set". Fault finding:

  1. Only customers of type Person fails.
  2. ContactPerson import also fails with the same error.
  3. CustCustomerV3Entity has been extended by myself. Fields have been added from datasource DirPartyBaseEntity
  4. DirPartyBaseEntity has been extended by myself. This extensions comes from extensions on DirOrganization and DirOrganizationBase. The extensions make sense in my mind. They are quite standard and logical. I can explain further... And they obviously compile successfully.
  5. The following code in SysDataEntityPersister throws a System.NullReferenceException (I highlighted the problem part). 
  6. This where I am at the moment. I posted because I am not sure what to do next. Also I find this interesting and I suspect it might be a Microsoft bug.
  7. Some debugging info: If a customer of type organization gets imported, variable dataSourceField is initialized correctly with my extension field(s). In the case of a person customer, the variable is null. Hence the exception when dataSourceField.id() is called. I know it is something to do with the inheritance table structure, but I do not know how to articulate it.

Side note: This "Forum" dropdown on the "New Post" web page becomes unresponsive if you try to select a forum before the page is fully loaded. I don't know where to post it, so here it is.

Thanks for reading

Reply
Rahul Mohta responded on 6 Jun 2019 4:56 AM

customer entity has gone undergone changes

could you try with v2 of customer data entity

also is this 10.0?

Reply
Pete Alberts responded on 6 Jun 2019 4:59 AM
My Badges

Hi Rahul

There is a V3 customer entity. I mentioned which element I am using in point number 3.

Yes this is V10.

Reply
Pete Alberts responded on 6 Jun 2019 8:03 AM
My Badges

Further on my extensions (I'm mentioning one of a few, but they all follow the same concept):

  1. DirOrganization.XYZExtension contains RefRecId field XYZSomeReference. It references XYZSomeRefTable.
  2. DirPartyBaseEntity.XYZExtension contains readonly datasource XYZSomeRefTable, private field XYZSomeReference and public key fields for XYZSomeRefTable.
  3. The relation on datasource XYZSomeRefTable is joined to DirPartyTable with the Join Derived Table property set to DirOrganization
  4. The key fields that I added on DirPartyBaseEntity.XYZExtension I then pulled through in my CustCustomerV3Entity.XYZExtension

Let me know if that is unclear - I'll try explaining again.

Reply

Hi Pete,

Can you tell in more details what exactly you had changed on the Customer V3 entity and the DirPartyBase entity? Did you fully build the model and also synced the database?

Reply
Pete Alberts responded on 14 Jun 2019 3:02 AM
My Badges

Thanks Andre

The error was in UAT......massive crisis lol. So yes the model is built and synced. I had no option but to move my changes away from DirPartyBaseEntity.

I have isolated the issue further. The problem is not in CustCustomerV3 entity. It is in DirPartyBaseEntity. And it isn't related to the reference field or added datasources.

I will be posting shortly. I have a free space VM where I am testing the issue. Will report.

Reply
Pete Alberts responded on 14 Jun 2019 3:25 AM
My Badges

Here is a simple example which I just did:

  1. Extend DirOrganization. Add a single field:
    •  
  2. Extend DirPartyBaseEntity
  3. Build & sync :)
  4. Try to use any entity that utilizes DirPartyBaseEntity. I opened the smmContactsListPage and used the open in excel option.
  5. You will find that the extension of DirPartyBaseEntity now causes SysDataEntityPersister to throw an error if any party type other than organization is handled.
Reply

HI Pete ,

Did you debug the CustCustomerV3Entity  defaultrow method where Partytype is assigned ? What values are being assigned over there when you import data ?

Reply
Verified Answer

Hi Pete,

Did you refresh the entity list from the framework parameters? If this is not helping you, then I do think, like you, it could be a bug and you can then contact Microsoft Support for some assistance.

Reply
Pete Alberts responded on 18 Jun 2019 5:20 AM
My Badges

Hi Andre, thanks

Yes I did refresh the list. I also deleted both CustCustomerV3Entity and smmContactPersonV2Entity entities from the list and refreshed to make sure. Still the same issue.

I do not know how to contact Microsoft Support :) #believeIt

Actually I did not know something like that exists for development.

Reply
Pete Alberts responded on 18 Jun 2019 5:21 AM
My Badges

Thanks Sukrut

PartyType is correctly assigned yes. But that is what causes the error. I want to post a detailed explanation on why. But I am afraid time is not on my side.

Reply
Verified Answer

Hi Pete,

Did you refresh the entity list from the framework parameters? If this is not helping you, then I do think, like you, it could be a bug and you can then contact Microsoft Support for some assistance.

Reply

SBX - Two Col Forum

SBX - Migrated JS