"Go to the Main Table Form" differences between Axapta 2.x and Dynamics AX 4

本文探讨了从Axapta 2.x到Dynamics AX 4中GoToMainTableForm功能的变化。在AX4中,此功能不再过滤子表单并更新父表单记录。文章提供了恢复旧行为的方法,并指出该方法存在的局限。

"Go to the Main Table Form" differences between Axapta 2.x and Dynamics AX 4
 
Good morning,
 
The "Go To Main Table Form" functionality in Axapta used to filter on the child form for the calling record, as well as update as the parent form changed record. In AX 4 that is no longer the case, though child forms opened through menuitem buttons do still behave this way. What happens is that in AX 4, the calling record is no longer passed in args.record() (therefore, linkActive() is no longer triggered on the child datasource); the args members lookupField() and lookupValue() are populated instead with the calling control's information.
 
If for some reason you want to get back to the jumpref() behavior of Axapta 2.x, add the following code to the SysSetupFormRun class new() method. You may want to create a per-user parameter to enable/disable this feature:
 
void new(Args args)
{
    (...)
    SysSetupFormRun formRun;
    ;
 
    if (!args.record() && args.lookupField()
        && SysUserInfo::find().MyNewJumpRef2xNoYesParameter
        && SysDictClass::is(args.caller(), classnum(SysSetupFormRun)))
    {
        formRun = args.caller();
        if (formRun.objectSet() && formRun.objectSet().cursor())
        {
            args.record(formRun.objectSet().cursor());
        }
    }
    
    super(args);
    (...)
}
 
Note: See SysFormRun::isCalledFromJumpRef(_args, _field) for example
 
Note2: This implementation is very flawed and doesn't work on records that contain two or more fields with similar relationships (such as the Ledger Accounts on Item Groups). This should instead be coded by adding a QueryBuildDynalink linking the parent and child forms together through the related fields. I leave the details up to the reader.

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值