2017-04-11 112 views
0

這是我的代碼:參數對象未初始化AX 2012

static void main(Args args) 
{ 
    LedgerJournalId ledgerJournalId; 
    HSinvoiceAcknowledgement hSinvoiceAcknowledgement = new HSinvoiceAcknowledgement(); 

    if (classidget(args.caller()) == classnum(syssetupformrun)) 
    { 
     if (formhasmethod(args.caller(), identifierstr(HSjournalnum))) 
     { 
      ledgerjournalid = args.caller().HSjournalnum(); 
     } 
    } 

    if(ledgerJournalId) 
    { 
     hSinvoiceAcknowledgement.parmJournalNum(ledgerJournalId); 
    } 
    if (hSinvoiceAcknowledgement.prompt()) 
    { 
     hSinvoiceAcknowledgement.run(); 
    } 
} 

參數數量ARGS在我的主要方法參數但是它說,

參數對象未初始化

可能是什麼問題?

回答

1

只需添加額外的檢查,以確保args不爲空。爲幫助長官亞歷山大·再次更換

if (classidget(args.caller()) == classnum(syssetupformrun)) 

if (args && 
    args.caller() && 
    classidget(args.caller()) == classnum(syssetupformrun)) 
+0

謝謝! –