I am trying to use the new 'Chain Of Command' feature in D365FO by extending CustTable.
We need to check if a value has changed on the update method, before we log it in a new table.
[ExtensionOf(tableStr(CustTable))]
final class CustTable_Extension
{
void update(boolean _updateSmmBusRelTable = true, boolean _updateParty =
true)
{
CustTable custTable_Orig = this.orig();
boolean hasChanged = this.CreditMax != custTable_Orig.CreditMax;
next update(_updateSmmBusRelTable, _updateParty);
if(hasChanged)
{
//do something
}
}
}
However when running this code we get "Object is not set to an instance of an object" error. The error occurs because 'this' object is null. I also get the same error when calling "next update(_updateSmmBusRelTable, _updateParty);".
The documentation states: "This allows extending the logic of public and protected methods without the need to use event handlers. When you wrap a method, you can also access other public and protected methods and variables of the class."
Any ideas?
You have to (re-)compile package with
CustTable
-Application Suite
with PU9 or newer.See https://learn.microsoft.com/en-us/dynamics365/unified-operations/dev-itpro/get-started/whats-new-platform-update-9#supported-versions: