Inserting Additional text line in Combine Shipments through event subscription
mfh
Member Posts: 28
Hi,
I want to add functionality that inserts the Sales Shipment Header field 'Your Reference' as a text line in the Sales Invoice, before the Sales Shipment Lines are inserted. I am using R295 Combine Shipments or the function 'Get Receipt Lines from the invoice card.
In order to do this without modifying the standard object T111 Sales Shipment Line, I would like to use an event from this table:
OnBeforeInsertInvLineFromShptLineBeforeInsertTextLine
In a CodeUnit, I wrote below code. However, this gives me the error 'Record in Table Sales Line already exists: Line No.=10000.
I guess I'm doing something wrong here (besides not hiring a skilled developer
), but what?

I want to add functionality that inserts the Sales Shipment Header field 'Your Reference' as a text line in the Sales Invoice, before the Sales Shipment Lines are inserted. I am using R295 Combine Shipments or the function 'Get Receipt Lines from the invoice card.
In order to do this without modifying the standard object T111 Sales Shipment Line, I would like to use an event from this table:
OnBeforeInsertInvLineFromShptLineBeforeInsertTextLine
In a CodeUnit, I wrote below code. However, this gives me the error 'Record in Table Sales Line already exists: Line No.=10000.
I guess I'm doing something wrong here (besides not hiring a skilled developer

Regards,
Michiel
Michiel
0
Answers
-
Try finding the first line and divide the line no with 2 and use that as you line no
For help, do not use PM, use forum instead, perhaps other people have the same question, or better answers.0 -
Hi Sander,
That's not the solution. Even if I use a "Line No." := 5000, I would receive the same error, but then on line 5000, of course.
But I did found out why I am getting the 'Line No.=10000 already exists' error: the Insert at the end of my code is not necessary, because this is handled by the original code in T111 after having returned from the extension. So I was Inserting a second time on the same record. Without the Insert in my extension, the result is this:
And that's almost what I expected, except for the fact that I am now missing the default 'Shipment No.:' text on the first line. For this particular case this is fine, but I would actually rather have the new text line inserted after the default 'Shipment No.:' line. I guess there should be an Insert of this line before going into the event, but I do not now how to achieve this. Any ideas?Regards,
Michiel0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K 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
- 610 NAV Courses, Exams & Certification
- 1.9K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 251 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions
