web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :

Chain of command example

M Anas Khan Profile Picture M Anas Khan 1,424

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;
    }
}

This was originally posted here.

Comments

*This post is locked for comments