我无法在网上找到任何结论。
获得了我在Enterprise Portal(EP)中使用的AX列表页面。
我有一个调用我的班级EPDocuGet的动作menuitem。
我尝试过很多不同的代码,但是当我使用getFirst()
方法时会出错。
这是我的代码示例:
CustInvoiceJour = args.multiSelectionContext().getFirst();
while(CustInvoiceJour)// if record exists
{
info(CustInvoiceJour.InvoiceId);
// getting the next marked record form the caller form
CustInvoiceJour = args.multiSelectionContext().getnext();
}
如果我使用CustInvoiceJour = args.record().data();
,它仍将获得多选中的第一条记录。
这是堆栈:
object not initialized
(C)\Classes\\getFirst
(C)\Classes\EPDocuGet\run - line 25
(C)\Classes\EPDocuGet\runDownload - line 16
Microsoft.Dynamics.AX.ManagedInterop
at Microsoft.Dynamics.AX.ManagedInterop.Object.CallWithReturnType(String methodName, Type returnType, Object[] paramList)
at Microsoft.Dynamics.Framework.BusinessConnector.Session.DynamicsObjectAdapter.Call(String methodName, Object param1)
有人知道如何正确地做到这一点......?
继承代码的其余部分:
void run(Args args = null)
{
IISResponse response = new IISResponse();
CustInvoiceJour CustInvoiceJour;
MultiSelectionHelper selection;
;
// Transition to a server function to avoid
// Security problems
if (args)
{
if (args.record().TableId == tableNum(DocuRef))
{
EPDocuGet::runDocument(args.record().data(), response);
}
// Begin change
// Description:
else if (args.record().TableId == tableNum(CustInvoiceJour))
{
CustInvoiceJour = args.multiSelectionContext().getFirst();
while(CustInvoiceJour)// if record exists
{
// getting the next marked record form the caller form
EPDocuGet::downloadPDF(CustInvoiceJour.invoiceid);
CustInvoiceJour = args.multiSelectionContext().getnext();
}
}
else if (args.record().TableId == tableNum(MpasMonthInvoiceJour))
{
// if(curUserId() == "admin")//todo: here
// {
//info(curUserId());
if(EPDocuGet::createMonthInvoiceJour(args.record().data()))
EPDocuGet::downloadMonthInvoiceJour(args.record().data(), response);
else
warning("Samlefaktura ikke tilgjengelig");
// }
// else
// EPDocuGet::downloadMonthInvoiceJour(args.record().data(), response);
}
}
}