Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Mark same customer invoice partially with X++ more than once

(0) ShareShare
ReportReport
Posted on by 1,935

Hi,

I manually enter the amount and then mark the customer invoice for settlement.

Here is the code:

	
	select custTransOpen where custTransOpen.AccountNum == "CUST01"
                join custTrans where custTrans.Invoice == ltrans.Invoice
                     && custTrans.RecId == custTransOpen.RefRecId
                    && custTrans.AccountNum == custTransOpen.AccountNum;

    if(custTransOpen)
    {

        manager = custvendopentransmanager::construct(ltrans);
        manager.updateTransMarked(custTransOpen,true);

        ttsBegin;
        ltrans.selectForUpdate(true);
        ltrans.SettleVoucher    = SettlementType::SelectedTransact;
        ltrans.update();
        ttsCommit;
	}

This code fails if I try to mark the same invoice again with a payment journal before the previous partially marked payment journal is posted.

For eg. if $100 invoice is 1st marked by $60 amount in line1 and then If I again try to mark it with $40 amount in line2 or in some other payment journal, It throws this error: "This invoice is already marked for settlement."

How can I change my code to successfully mark invoices partially with payment journals before posting the payment journals?

*This post is locked for comments

  • Evan Adamson Profile Picture
    Evan Adamson 105 on at
    RE: Mark same customer invoice partially with X++ more than once

    Hi MYGz, Were you successful in splitting the payment into separate CustTransOpen records and did you need to create paired CustTrans records as well?

  • MYGz Profile Picture
    MYGz 1,935 on at
    RE: Mark same customer invoice partially with X++ more than once

    Thank you André for clearing the doubt.

  • Verified answer
    André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 292,516 Super User 2025 Season 1 on at
    RE: Mark same customer invoice partially with X++ more than once

    Hi MYGz,

    The validation is performed per CustTransOpen record. If you can split the open amount in multiple records for one CustTrans in the CustTransOpen table, it would allow you to do multiple settlements. But it is always one settlement per CustTransOpen record.

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,436 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans