Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

Force Update of Form Sales Lines Modified through Code

Posted on by Microsoft Employee

Our users have asked for a custom line number field for Sales Lines. They want a simple integer that would be renumbered whenever new lines are inserted or existing lines are deleted.

I have written code that renumbers lines on the SalesTable form whenever new lines are inserted and deleted. However, only the last line selected gets updated in the database when the user closes the form or steps off the line. Is there any way to force an update on all of the lines when they get renumbered?

Right now, I am doing this with an update event on the SalesLine table, and that works with some minor screen flickering on the SalesLine grid. However, since this is an event on the SalesLine table itself, it will result in a significant performance hit whenever sales lines are bulk loaded.

*This post is locked for comments

  • Sohaib Cheema Profile Picture
    Sohaib Cheema 46,610 User Group Leader on at
    RE: Force Update of Form Sales Lines Modified through Code

    There are classes such as SalesLineType >> insert/update methods

    Put your logic there before or after super [ .doinsert() ] depending upon requirement.  While a line is inserted, you can get the total number of lines with same SalesId where Line.Recid != thisLine.RecId and finally add +1 to it, to get next counter.

    However, as you also setting numbers free on deletion of the line, by renumbering all existing lines of that sales Order, this mayn't be great thing for performance.

    I would be more interested to know business requirement in such cases, rather than to think about code.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans