Posting mod not working as expected

bhalpin
Member Posts: 309
Hi.
(This is NAV 4 on local (C/Side) database. Will be implemented in database on NAV server.)
I am doing a mod to sales orders & posting. When the user enters a sales line posting to a G/L account, and then posts, I am 'sneaking in' and adding addional Sales Line records that hae to be posted along with the G/L line. (Long story, but that's the situation.)
In CU 80 Sales-Post, at the top of OnRun() I call a custom function that figurers out and creates the sales line(s), sets up dimension records, etc. When it returns, OnRun() posts the lines beautifully. All is well.
But, one little problem remains: If posting the Sales Order fails for any user-related reason (missing dimension value, missing tax code, missing external doc no.) and posting aborts with the usual error message, then the new lines I created now appear on the sales order sub-form.
I was hoping that Sales-Post was an 'atomic' operation whereby all database changes are rolled back (including removing my new sales line) if something goes wrong - it seems to work that way everywhere else. But that doesn't seem to be the case here. :-k
Any thoughts, or pointers to what I should study up on?
Thanks!
(This is NAV 4 on local (C/Side) database. Will be implemented in database on NAV server.)
I am doing a mod to sales orders & posting. When the user enters a sales line posting to a G/L account, and then posts, I am 'sneaking in' and adding addional Sales Line records that hae to be posted along with the G/L line. (Long story, but that's the situation.)
In CU 80 Sales-Post, at the top of OnRun() I call a custom function that figurers out and creates the sales line(s), sets up dimension records, etc. When it returns, OnRun() posts the lines beautifully. All is well.
But, one little problem remains: If posting the Sales Order fails for any user-related reason (missing dimension value, missing tax code, missing external doc no.) and posting aborts with the usual error message, then the new lines I created now appear on the sales order sub-form.
I was hoping that Sales-Post was an 'atomic' operation whereby all database changes are rolled back (including removing my new sales line) if something goes wrong - it seems to work that way everywhere else. But that doesn't seem to be the case here. :-k
Any thoughts, or pointers to what I should study up on?
Thanks!
0
Comments
-
There is a commit in CU80 after it gets the next invoice number. You are going to have to put your code after the commit.David Singleton0
-
Ahhh a COMMIT ... shoulda looked for it. Thanks.0
-
You're welcome.David Singleton0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions