Invoicing multiple Sales order using code in AX 2012

Wondering how to post invoice for multiple Sales orders?? Below is the solution.


SalesFormLetter salesFormLetter;
    QueryRun queryRun;
    Query query;
    str strSalesTable = "000630,000631,000643";
    ;

    salesFormLetter = SalesFormLetter::construct(DocumentStatus::Invoice);

    query = new Query(QueryStr(SalesUpdate));
    query.dataSourceTable(tablenum(SalesTable)).addRange(fieldnum(SalesTable, SalesId)).value(strSalesTable);
    queryRun = new QueryRun(query);

    salesFormLetter.chooseLinesQuery(queryRun);
    salesFormLetter.transDate(systemdateget());
    salesFormLetter.specQty(SalesUpdate::All);
    salesFormLetter.printFormLetter(true);
   
   
    salesFormLetter.chooseLines();  

    salesFormLetter.run();

Comments

  1. Halo,I'm Helena Julio from Ecuador,I want to talk good about Le_Meridian Funding Service on this topic.Le_Meridian Funding Service gives me financial support when all bank in my city turned down my request to grant me a loan of 500,000.00 USD, I tried all i could to get a loan from my banks here in Ecuador but they all turned me down because my credit was low but with god grace I came to know about Le_Meridian so I decided to give a try to apply for the loan. with God willing they grant me  loan of 500,000.00 USD the loan request that my banks here in Ecuador has turned me down for, it was really awesome doing business with them and my business is going well now. Here is Le_Meridian Funding Investment Email/WhatsApp Contact if you wish to apply loan from them.Email:lfdsloans@lemeridianfds.com / lfdsloans@outlook.comWhatsApp Contact:+1-989-394-3740.

    ReplyDelete

Post a Comment

Popular posts from this blog

Reciprocal exchange rate in same legal entity

External Code unique value limitation D365FO