web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)
Unanswered

PurchFormLetter in Batch

(0) ShareShare
ReportReport
Posted on by

Hello Community, i'am trying to sent a purchase order update into the batch system like the batch button on the purchform does. But it doesn't work right now. The query in PurchFormLetter.run does not get any records and does not at the task to the batch system. I think it's because the parm - tables are not written to the database. Does anybody have an idea what's wrong here? See my code at the bottom.

Regards Andi

 static void TST_PostPurchBatch(Args _args) { PurchFormLetter letter = PurchFormLetter::construct(DocumentStatus::PurchaseOrder); PurchTable purchTable = PurchTable::find('000376'); PurchParmLine parmLine; ; ttsBegin; letter.purchTable(purchTable); letter.transDate(systemDateGet()); letter.specQty(PurchUpdate::All); letter.proforma(false); letter.printFormLetter(true); letter.createParmUpdate(); letter.initParameters(letter.purchParmUpdate(), PrintOut::Current); // Printout info(letter.parmId()); letter.initLinesQuery(); letter.chooseLinesQuery(); while select forUpdate parmLine where parmLine.ParmId == letter.parmId() { // changed the Qty parmLine.ReceiveNow = 3; // the following is stollen from the SalesEditLines form (field modified method) parmLine.setQty(parmLine.purchParmTable().ordering, letter.purchParmUpdate().creditRemaining); parmLine.setInventReceiveNow(); parmLine.setLineAmount(); if (parmLine.closed) { parmLine.remainAfter = 0; parmLine.setRemainAfterInvent(); } // parmLine.calcPackingUnitQty(); parmLine.update(); } //letter.run(); Don't want to start directly letter.batchInfo().parmBatchExecute(true); letter.batchInfo().parmGroupId(''); letter.batchInfo().doBatch(); ttscommit; BatchRun::runJobStatic(letter.batchInfo().parmBatchId()); }

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at

        PurchTable              purchTable;
        PurchReqLine            purchReqLine;
        PurchFormLetter         purchFormLetter;
        ;

        //We get the purch id from the first purchreqline which is ok for eprocurement
        select firstonly purchReqLine where purchReqLine.PurchReqId == _purchReqTable.PurchReqId;
        purchTable = purchReqLine.purchTable();

        //Post the invoice an print it
        purchFormLetter = PurchFormLetter::construct(DocumentStatus::PurchaseOrder);

        purchFormLetter.parmSourceTable(purchTable);
        purchFormLetter.printFormLetter(true);
        purchFormLetter.usePrintManagement(true);
        purchFormLetter.proforma(false);
        purchFormLetter.specQty(PurchUpdate::All);
        purchFormLetter.createParmUpdate();
        purchFormLetter.initParameters(purchFormLetter.purchParmUpdate(), PrintOut::Current);  // Printout
        purchFormLetter.initLinesQuery();
        purchFormLetter.chooseLines();

        purchFormLetter.batchInfo().parmBatchExecute(NoYes::Yes);
        purchFormLetter.batchInfo().parmCaption("");
        purchFormLetter.batchInfo().doBatch();

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Sanhthosh.Kumar.K Profile Picture

Sanhthosh.Kumar.K 2

#2
Raed Salah Bzour Profile Picture

Raed Salah Bzour 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans