Options

How to update sales header from sales lines

sundfarsundfar Member Posts: 28
I have some requirements which basically says; if any sales lines are modified, I need to modify a status in the sales header table.
I call my code from OnModify()-trigger of a field in Sales Line. After the update the user using the Order Form receives the dreaded: "Another user have changed the field for this Sales Header...".

Are there any way to reference the Sales Header-table from a trigger in the Sales Line-table and do modifications without getting the error message mentioned?

We're using5.0 and SQL.

Best regards,
Gunnar

Comments

  • Options
    kinekine Member Posts: 12,562
    There must be some other process which is modifying the header. Run the Client monitor or debugger and see where it is. If you just change the header once, you will not get this error.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    garakgarak Member Posts: 3,263
    kine is right. Check your table if there is a second or third "SalesHeader.modify;".
    It could also be, that you call a function from a codeunit and this function modifies the SalesHeader.

    So, start the Clientmonitor, do your changes in the sales line to become the error message and search then in the Clientmonitor for @*modiy;* or @*SalesHeader.modify;*.

    Instead of the Client Monitor u can also use the "Code Coverage".

    Regards
    Do you make it right, it works too!
  • Options
    sundfarsundfar Member Posts: 28
    Thanks for the suggestions, I'll give it a try and come back to you.

    Regards, Gunnar
Sign In or Register to comment.