Hi everyone,

I want to use a string of customer accounts to create a query to post 
multiple invoices at one time.

Here is my code:

    Query           query = new Query();
    QueryRun        queryRun;
    SalesTable      salesTable;
    SalesLine       salesLine;
    SalesFormLetter salesFormLetter;
    ;

// strCustAcct has multiple customer accounts in it, separated by commas
query.addDataSource(tableNum(SalesTable)).addRange(fieldNum
(SalesTable,CustAccount)).value(strCustAcct);

salesFormLetter = SalesFormLetter::construct(DocumentStatus::Invoice);
salesFormLetter.queryChooseLines().query(query);
ttsbegin;
    salesFormLetter.update(salesTable, systemDateGet(), 
SalesUpdate::All, AccountOrder::None, false, false);
ttscommit;

I'm getting an error on the queryChooseLines method that tells me that 
SysQueryRun object not initialized. I tried putting a queryRun = new 
QueryRun(query); before constructing the SalesFormLetter, but still got 
the same error.

I don't even know if I'm doing the SalesFormLetter part correctly. How 
do I tell SalesFormLetter what query I want it to use to post my sales 
orders? Also, is the update enough to post the invoices or do I have to 
call SalesFormLetter.run() as well? Or instead?

Any help would be appreciated.

Thanks!

Reply via email to