Hi,
I have a requirement to add a field to the PurchLine and PurchLineHistory tables extensions for the purchase order versioning.
I was following the following link to do the required customization and I feel like I'm missing something, since it seems that it when it goes to version that field it cannot find it hence it throws "Object reference not set to an instance of an object.
Extend table maps that are used for versioning - Finance & Operations | Dynamics 365 | Microsoft Learn
As mentionned in the Microsoft documentation linked, I've done the following:
1) Added a new field on the PurchLine and PurchLineHistory table extensions
2) Created a new table map and added the new field to it.
3) On the PurchLine and PurchLineHistory table extensions, under mapping, I've added the new table map from point 2 and mapped the new field
4) I've created a new class that implements the PurchLineIVersioningFieldSet with the same methods as the PurchLineVersioningFieldSet class, to use the new table map that i've created. below is the code:
I get the error in the class VersioningPurchaseOrderArchivePurchLine method initFieldMapping, the selectDictField and insertDictField are null, hence on the next line when it uses those variables I get the 'Object reference not set to an instance of an object'. It seems that I cannot find the new field from the new table map that I've created.
I'm probably missing something but not sure. Any help is welcome.
internal final class PurchLineVersioningFieldSet_NAP implements PurchLineIVersioningFieldSet
{
[Wrappable(false)]
protected PurchLineMap_NAP purchLineMapFieldSet(PurchLineVersioning _purchLineVersion)
{
return _purchLineVersion.parmPurchLineVersion();
}
public boolean isChangeConfirmationRequired(PurchLineVersioning _currentPurchLineVersion, PurchLineVersioning _archivedPurchLineVersion)
{
PurchLineMap_NAP currentPurchLineMap_NAP = this.purchLineMapFieldSet(_currentPurchLineVersion);
PurchLineMap_NAP archivedPurchLineMap_NAP = this.purchLineMapFieldSet(_archivedPurchLineVersion);
boolean ret = false;
if (currentPurchLineMap_NAP.NoOfTimesVendClickedToSuggestChangesOnConfirmedPO_NAP != archivedPurchLineMap_NAP.NoOfTimesVendClickedToSuggestChangesOnConfirmedPO_NAP)
{
ret = true;
}
return ret;
}
[Hookable(false), Wrappable(false)]
public void copyVersion(PurchLineVersioning _targetPurchLineVersion, PurchLineVersioning _sourcePurchLineVersion)
{
PurchLineMap_NAP targetPurchLineMap_NAP = this.purchLineMapFieldSet(_targetPurchLineVersion);
PurchLineMap_NAP sourcePurchLineMap_NAP = this.purchLineMapFieldSet(_sourcePurchLineVersion);
targetPurchLineMap_NAP.data(sourcePurchLineMap_NAP.data());
}
[Hookable(false), Wrappable(false)]
public TableId fieldSetTableMapId()
{
return tableNum(PurchLineMap_NAP);
}
}