最新消息:ww12345678 的部落格重装上线,希望大家继续支持。

命令链示例 / Chain of command example

网络文摘 William 796浏览 0评论

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;
    }
}
发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址