I have an integration where I receive customers from a portal. They are created or updated in D365FO with the usertype from the portal using entity custCustomerV3Entity
From time to time the usertype changes from Organization to Person or reverse.
If I try to update the customer with this new Usertype I receive an error
Cannot update a party's type from 'DirOrganization' to 'DirPerson', a delete of the existing party followed by an insert with the new type should be performed instead.
I have tried to create a new dirpartytable with DirPartyTable::createNew but it seems s if the old dirpartytable record is still in use.
CustTable custtable = CustTable::find(customer.CustomerAccount,true);
custTable.Party = DirPartyTable::createNew(DirPartyType::Person,'').RecId;
custTable.doUpdate();
have anyone a suggestion on how to change the usertype
Thanks in advance