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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

X++ - Updating Discount Terms On PurchTable not Recalculate Discount

(0) ShareShare
ReportReport
Posted on by 95

Hi

I have an X++ method that will update a PO's discount terms.

When I call the Update or doUpdate method on PurchTable for that PO and look back in the PO screen in AX - I do not see anything changed for that PO Header (after refresh) - the discount term is still blank (thus discount amount etc. hasn't been calculated)?

*This post is locked for comments

I have the same question (0)
  • dolee Profile Picture
    11,279 on at

    Hi,

    - Which version of AX you are on?

    - Have you try Ctrl-F5?

    - Have you check the backend DB, is the record updated?

  • Suggested answer
    Community Member Profile Picture
    on at

    Can you please post the X++ methods code snippet to understand how you are updating the record.

    normally discount term field should  get updated.

    for discount amount may be you need to check if you have called the logic which will calculate the amount and assign the value to the relevant field.

    Please verify and update with your findings.

  • DAX09 Profile Picture
    2,470 on at

    Hi All

    I am using AX12(R2). Slimmed down snippet of code below:

    purchTable = PurchTable::find(myPurchId, true); // for upadte

    if (purchTable.PurchId) // found PO

    {

       purchTable.Payment = myValidPaymentTerm; // e.g. N030

       purchTable.CashDisc = myValidDiscountTerm; // e.g 4%D10

       ttsbegin;

       purchTable.Update(); // I have also tried "doUpdate()" - but nothing calculated

       ttscommit;

    }

  • Suggested answer
    Community Member Profile Picture
    on at

    Considering writing code like this

    ttsbegin;

    purchTable = PurchTable::find(myPurchId, true); // for upadte

    if (purchTable.PurchId) // found PO

    {

      purchTable.Payment = myValidPaymentTerm; // e.g. N030

      purchTable.CashDisc = myValidDiscountTerm; // e.g 4%D10

      //Call method to calculate the Discount amount

      purchTable.Update(); // I have also tried "doUpdate()" - but nothing calculated

    }

    ttscommit;

    Please verify and update with your finidngs

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Volodya Profile Picture

Volodya 2

#2
tgudwanski Profile Picture

tgudwanski 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans