在字段x ++ PurchCreateOrder中设置默认数据

问题描述 投票:0回答:1

我想基于PurchCreateOrder中的curUserid()设置默认值。如何将数据放在表单扩展的字段中?有没有更好的选择呢?字段绑定到数据源,并且我具有带有不同数据源的不同字段。

我的代码给了我带有nullreferences的异常终止错误。 XPPCompiler

[ExtensionOf(tableStr(PurchTable))]

final class PurchCreateOrderGetDefAdress_Extension
{
void initvalue(PurchaseType  _purchaseType)
{
    next initvalue(_purchaseType);

    PurchTable purchtable;
    LogisticsPostalAddress logpostadress;
    UserInfoSz usrsz;
    str user = curUserId(); 


    select firstonly logpostadress where logpostadress.city == 'lub';
   // select firstonly InventSiteId, InventLocationId from purchtable join usrsz where purchtable.InventSiteId == usrsz.InventSiteId && usrsz.IsDefault == true;
    select firstonly InventSiteId from usrsz where usrsz.UserId == user && usrsz.IsDefault == true;

    purchtable.initValue();
    purchtable.deliveryname = 'asasasasas' ;//logpostadress.Address;
    purchtable.inventsiteid = usrsz.InventSiteId;
    purchtable.inventlocationid = usrsz.InventSiteId;


    info(strFmt("%1, %2, %3", logpostadress.Address, usrsz.InventSiteId));

}

}
axapta microsoft-dynamics x++
1个回答
1
投票

错误很直接。

错误扩展类'PurchTable'提供了以此名称命名的方法,但是由于参数配置文件与原始方法不匹配,因此此方法不能用作命令方法链。]

查看突出显示的参数配置文件并与您的参数配置文件进行比较。

enter image description here

编辑:

查看这些链接,以获取更多有关命令链(CoC)的信息:
© www.soinside.com 2019 - 2024. All rights reserved.