axapta - 如何打开包含所选记录的表单?

标签 axapta x++ ax

假设我想在作业/代码中打开供应商表单。我编写了一个非常简单的选择语句,稍后我想用它来打开该特定供应商的供应商表单。我怎样才能实现这个目标?

VendTable vend;
MenuFunction menuFunction;
Args args  = new Args();

select vend
    where vend.AccountNum like "*0009*";
info(vend.AccountNum); - shows an AccountNum

args.record(VendTable::find(vend.AccountNum));
menuFunction = new MenuFunction(menuitemdisplaystr(VendTable), MenuItemType::Display);
menuFunction.run(args);

供应商表单已打开,但未设置数据。如有任何帮助,我们将不胜感激。

最佳答案

如果 info(vend.AccountNum); 实际上在屏幕上输出了一个有效的供应商,那么您的代码没有任何问题并且应该可以工作。如果它不起作用,我猜你有某种修改或损坏的供应商数据。我用 AX 2009 进行了测试。我测试了您的代码和我自己的版本。这是我测试过的工作代码:

Args        args = new Args();
VendTable   vendTable;
;

select firstonly vendTable;

if (!vendTable)
    error("Missing vendor");

args.record(vendTable);

new MenuFunction(menuitemdisplaystr(VendTable), MenuItemType::Display).run(args);

关于axapta - 如何打开包含所选记录的表单?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19657872/

相关文章:

axapta - X++ "invalid token"message when calling c# library (How to call the method correctly)

axapta - AX7 : Creating a method on a View using the extension method (bug?)

axapta - 查询范围不等于0

batch-processing - 在运行时向批处理任务添加依赖项

batch-processing - 如何通过代码获取作业流程中的BatchJob Recid?

field - 两个字段合二为一 - Dynamics AX 中的表

axapta - 安装 AX 2012

microsoft-dynamics - Select 语句与在 Axe 中查找语句

axapta - Axapta/Dynamics Ax 中的主/明细表

axapta - Dynamics AX View 中的 LEFT JOIN