Hi Guys,
Just starting to learn CoC. Currently am a bit confuse of the order of these CoC, about who's goes first and then which one is next. I' creating 2 CoC classes like this :
1st class :
[ExtensionOf(tablestr(SalesTable))]
final class SalesTableTable_Extension
{
public void delete()
{
SalesTable salestablelocal;
next delete();
select firstonly salestablelocal where salestablelocal.salesid == this.salesId;
if (salestablelocal)
{
info(SalesTablelocal.SalesId);
}
else
{
info(strFmt("Sucessfully deleted %1", DateTimeUtil::getSystemDateTime()));
}
}
}
And 2nd class:
[ExtensionOf(tablestr(SalesTable))]
final class SalesTableTable_2_Extension
{
public void delete()
{
SalesTable salestablelocal;
next delete();
select firstonly salestablelocal where salestablelocal.salesid == this.salesId;
if (salestablelocal)
{
info(SalesTablelocal.SalesId);
}
else
{
info(strFmt("Okay, it is deleted %1", DateTimeUtil::getSystemDateTime()));
}
}
}
And when I test, create New Sales Order and delete it, it looks like the 2nd class goes first. Is it true that in CoC the last CoC class will be executed first, but how to know which one is the last if for example many developer are in our environment ?
Also in Micorosft docs : https://docs.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/extensibility/method-wrapping-coc
there is this statement :
The system randomly runs one of these methods, such as the doSomething method of the BusinessLogic1_Extension class. When the call to the next doSomething method occurs, the system randomly picks another method in the CoC. If no more wrapped methods exist, the system calls the original implementation.
So it is randomly or took the last one ? but also in that statement, after "randomly", if no more then call the original. Does it mean then the original Delete method will be executed ? but my CoC class resulted the record already deleted, means the original already finished firstly.
Thanks,