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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

SalesFormLetter parmId question

(0) ShareShare
ReportReport
Posted on by 427

Greetings,

I've written some custom code to create invoices for a specific situation. I'm using the code pasted below. I've noticed that the SalesParmUpdate record is reused and the related SalesParmTable rows are changed whenever my customization is executed. It does not seem to be the case with what SalesEditLines perform, as the parmId is always incremented. I haven't seen any "closing" method which must be done after SalesFormLetter.run() or clean-up process.

So basically, if anyone knows, am I missing some lines which prevent parmId to be reused or is it meaningless and can be disregarded?

private void createInvoice(Query _query, TransDate _invoiceDate, SalesUpdate _salesUpdate)

{
SalesFormLetter salesFormLetter;
QueryRun queryRun;
ParmId parmId;

queryRun = new QueryRun(_query);
salesFormLetter = SalesFormLetter::construct(DocumentStatus::Invoice);
salesFormLetter.specQty(_salesUpdate);
salesFormLetter.chooseLinesQuery(queryRun);
salesFormLetter.transDate(_invoiceDate);
salesFormLetter.printFormLetter(false);
salesFormLetter.chooseLines();
salesFormLetter.SumBy(AccountOrder::Account);
salesFormLetter.reArrange(false);
parmId = salesFormLetter.parmId();
salesFormLetter.run();
}

AX 2012 cu3 release 8

Regards,

Eric

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Arkadia2 Profile Picture
    427 on at

    Greetings,

    Instead of using SalesFormLetter, I create a SalesFormLetter_invoice object directly and force LoadFromSysLastValue to false. Default behaviour from SalesFormLetter is set to true. So far it seems to be holding up. I'll check, I may have a few useless initXXXX() lines, but it looks like this if anyone runs into a similar situation:

    private void createInvoice(Query _query, TransDate _invoiceDate, SalesUpdate _salesUpdate)

    {

       SalesFormLetter_invoice letter = new salesFormLetter_invoice();

       QueryRun queryRun = new queryRun(_query);

       letter.initParmDefault();

       letter.parmLoadFromSysLastValue(false);

       letter.init();

       letter.specQty(_salesUpdate);

       letter.chooseLinesQuery(queryRun);

       letter.transDate(_invoiceDate);

       letter.printFormLetter(false);

       letter.chooseLines();

       letter.SumBy(AccountOrder::Account);

       letter.reArrangeNow(true);

       letter.reArrange(false);

       letter.run();

    }

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
CP04-islander Profile Picture

CP04-islander 39

#2
Michel ROY Profile Picture

Michel ROY 14

#3
imran ul haq Profile Picture

imran ul haq 8

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans