COC- Chain of Commands are used to override the Application suite objects.
In certain cases, like the code with public and protected access specified methods cannot be created a post or pre event handler by coping its event.
In that case we need to go with COC.
This can be achieved by using the keyword ExtensionOf()to load the object and next() as super.
Note: COC class needs to final and method that to be COC can be public access specifier.
Example. COC of form button event.
final class SalesLineType_Extension
public void insert(boolean dropInvent, boolean findMarkup, Common childBuffer, boolean _skipCreditLimitCheck)
custTable = CustTable::find(salesLine.CustAccount);
//Your code to perform action before the event;
next insert(dropInvent, findMarkup, childBuffer, _skipCreditLimitCheck);
//Your code to perform action After the event;
Note: Please make sure you are creating methods with same number arguments and same pattern of arguments as well to the calling methods ie next.