Sunday, June 23, 2019

How to post multiple Free Text Invoices using x++ D365 FO

These days one of the most common requirements is to post multiple Customer Invoices in a single click.


Here is an example :-

[FormControlEventHandler(formControlStr(CustFreeInvoice, BulkPost), FormControlEventType::Clicked)]
public static void BulkPost_OnClicked(FormControl sender, FormControlEventArgs e)
{

    FormDataSource                fds;
    MultiSelectionHelper         selectionHelper = MultiSelectionHelper::construct();
    Set                                       selectedRecords = new Set(Types::Record);
    CustInvoiceTable                custInvoiceTable;
    CustPostInvoice                  custPostInvoice;
     
        fds = sender.formRun().dataSource('CustInvoiceTable');

        custInvoiceTable = fds.cursor();

        selectionHelper.parmDataSource(fds);
        custInvoiceTable  = selectionHelper.getFirst();

        if (custInvoiceTable.RecId)
        {
            while (custInvoiceTable)
            {
                selectedRecords.add(custInvoiceTable);
                custPostInvoice = new CustPostInvoice(custInvoiceTable);
                custPostInvoice.run();
                custInvoiceTable = selectionHelper.getNext();
            }
        }

        fds.research();
        fds.reread();
        fds.refresh();

        Box::info('Invoice Posting Completed Successfully');
}

2 comments:

  1. You're not paranoid, indeed you believe online business is a passing fad and will soon go away. Andy Grove, Intel's co-founder, once said, "Only the Paranoid Survive". The internet is not likely to go away soon. tax invoice template NZ

    ReplyDelete
  2. Nationwide, according to our most recent survey, there are 724 casinos around the country; comprised of 442 commercial operations, about half of which are located in Nevada, and 282 Indian gaming venues, of which 209 offer most, if not all, of Las Vegas type (Class III) games. pragmatic demo slot

    ReplyDelete

How to reverse Free Text Invoice Voucher entries without Dialog

 Hey Folks ,  This blog post is in continuation of the previous post for Reversing Free Text Invoice Voucher entries with Dialog. Only diffe...