Creating gift sales lines
delaghetto
Member Posts: 89
Hi all!
I'm trying to implement a new feature in NAV 2013. Basically this customer has promotions like for example if you buy 2 units of Item A you get one more unit for free.
The customer wants this "gift" unit to be a new sales line in the same order with unit price 0.
So I'm using something like the Sales Line discount functionality, that when the Quantity is modified, it automatically updates the %discount field is there is any promotion created, but in my case, I need to create a new line in stead.
I'm having some problems with this, because the Sales Line Table seems to be locked during validations, so I'm not able to create a new line.
So I guess I must create this new line after the validations are over and the table is unlocked.
Also another problem I'm having is that when I create a new line, all examples I've seen are something like:
SalesLine.VALIDATE(Quantity,Cantidad);
SalesLine.VALIDATE("Unit Price",Precio);
SalesLine.INSERT(TRUE)
But in this case the Unit Price is 0 and the Quantity doesn't need a validation, because otherways it would again create the gift Lines recursively.
Is there any problem with doing?:
SalesLine.Quantity := Cantidad;
SalesLine."Unit Price" := 0;
SalesLine.INSERT(TRUE);
Anyway I'm quite a newbie in NAV development, so I would like some advice on where to place the code for my new line insert.
Thanks!
I'm trying to implement a new feature in NAV 2013. Basically this customer has promotions like for example if you buy 2 units of Item A you get one more unit for free.
The customer wants this "gift" unit to be a new sales line in the same order with unit price 0.
So I'm using something like the Sales Line discount functionality, that when the Quantity is modified, it automatically updates the %discount field is there is any promotion created, but in my case, I need to create a new line in stead.
I'm having some problems with this, because the Sales Line Table seems to be locked during validations, so I'm not able to create a new line.
So I guess I must create this new line after the validations are over and the table is unlocked.
Also another problem I'm having is that when I create a new line, all examples I've seen are something like:
SalesLine.VALIDATE(Quantity,Cantidad);
SalesLine.VALIDATE("Unit Price",Precio);
SalesLine.INSERT(TRUE)
But in this case the Unit Price is 0 and the Quantity doesn't need a validation, because otherways it would again create the gift Lines recursively.
Is there any problem with doing?:
SalesLine.Quantity := Cantidad;
SalesLine."Unit Price" := 0;
SalesLine.INSERT(TRUE);
Anyway I'm quite a newbie in NAV development, so I would like some advice on where to place the code for my new line insert.
Thanks!
0
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
- 322 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