Hi team,
Requirement - Initialized the value in Custgroup while creating a record in CustTable
CoC on Insert method -
[ExtensionOf(tableStr(CustTable))]
final class CustTable_Extension
{
public void insert()
{
this.CustGroup = 'RETAIL';
next insert();
}
}
Table event - Oninserting
[DataEventHandler(
tableStr(CustTable),
DataEventType::Inserting)]
public static void CustTable_onInserting(
Common sender,
DataEventArgs e)
{
CustTable custTable = sender as CustTable;
custTable.CustGroup = 'RETAIL';
}
As per my assumption, For this particular requirement, the end result can be the same. Both can set CustGroup before the record is inserted.
But the important thing is
In CoC - We extending the method.
In Event handlers - Here wr responding to an event, not wrapping or extending the insert() method.
The MS recommended to use CoC instead of Event handlers. Whenever possible.
Am I correct?
Pls advise thanks

Report
All responses (
Answers (