Purpose:
The purpose of this post is to demonstrate how we can we extend a standard code by using the chain-of-command framework.
Product:
Dynamics 365 for Finance and Operations
Description:
The code below extends the saveAttributeValueSet method of DimensionEntryControl class using the chain-of-command framework.
Code:
[ExtensionOf(classStr(DimensionEntryControl))]
final class DimensionEntryControlSXS_Extension
{
public DimensionDefault saveAttributeValueSet()
{
#define.CallerFormName("CustTable")
DimensionDefault retCurrentAttrValueSetId;
CustTable custTable;
retCurrentAttrValueSetId = next saveAttributeValueSet();
if (this.formRun().args().callerName() == #CallerFormName)
{
FormDataSource dirPartyEntity_ds = this.formRun().dataSource(formDataSourceStr(DirPartyQuickCreateForm,DirPartyEntity));
if (dirPartyEntity_ds)
{
custTable = dirPartyEntity_ds.cursor();
custTable.DefaultDimension = retCurrentAttrValueSetId;
custTable.modifiedField(fieldNum(CustTable, DefaultDimension));
}
}
return retCurrentAttrValueSetId;
}
}