Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested answer

Saving Form Header triggers firstly saving Lines

(0) ShareShare
ReportReport
Posted on by 15

I have a big problem, like in the title "Saving Form Header triggers firstly saving Lines", but let me explain...

I'm creating new record in SalesQuotationTable and fill it with one line. Values is not importatant, everything can be random untill it validate correct.

So here comes my problem:
(Everything happen on Lines View)

1. I change "Product Name" string (or any value) on added line. (That is the most importat step)
2. I click on Header. (Line write triggers, and saves the line)
3. I change any value on Header (I choose a value that is visible on Lines Details, so for example "Adress" or "Delivery date")
4. I click Ctrl+S.

And here is my problem, because after step 4. the Line write triggers first (Not header), the code saves lines and header values, and after this the header write method triggers and starts looking for any typed changes (xRecord.Field != xRecord.orig().Field). He find nothing, because the line's write method updated the Orig a second ago.

What I discoveded is that after changing something on line and next on the Header, then Ctrl+S triggers leaveRecord method, and the super method calls ValidateWrite/Write on the lines.
When I change only Header valuses and click Ctrl+S, then leaveRecord calls ValidateWrite/Write on Table(Header) first.

Anyone can have any idea what happens, and why Lines are updated before header that updates the header? 

PS I know this explanation can be complicated, so ask me everything. I lost 2 days on this issue 

  • Suggested answer
    ArnoldVW Profile Picture
    ArnoldVW on at
    RE: Saving Form Header triggers firstly saving Lines

    Hello Lukasz,

    System updates Coverage status for Master planning (QuotationTable.CovStatus) whenever a date on the line is updated. This will make sure Master planning will reconsider this quotation again when updating net requirements, because the requirement date is changed. Code responsible for this is in SalesQuotationTableLineType::update: 

    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    public void update(boolean _dropInvent = false,
    Common _childBuffer = null,
    boolean _updateOrderLineOfDeliverySchedule = true)
    {
    InventUpd_Estimated estimated;

    ttsbegin;

    salesQuotationLine.setQuotationStatus();

    salesQuotationLine.ConfirmedDlv = salesQuotationLine.ShippingDateRequested;
    this.updateSalesQuotationTable();

    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    SalesQuotationLineType::updateSalesQuotationTable runs:

    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    void updateSalesQuotationTable()
    {
    SalesQuotationTable salesQuotationTable;

    salesQuotationTable = salesQuotationLine.salesQuotationTable(update);

    salesQuotationTable.CovStatus = 0;

    salesQuotationTable.write();
    }

    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    This ALWAYS updates Quotation table.

    In D365FO this behavior was changed with update https://fix.lcs.dynamics.com/Issue/Details?kb=4602931&bugId=518567. This made sure the quotation table was only updated when CovStatus field is not yet set to value <> 0. and additionally checks if any quotation line fields have been updated. This will reduce the number of times the Quotation table gets updated. This update is not available for AX 2012 however. 

    I hope this helps understand why you see Quotation header getting updated first.

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

Announcing Our 2025 Season 1 Super Users!

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

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 231,305 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans