Our support engineers have assembled the top recommended solutions for you.
Microsoft Dynamics AX 2012
Data Import, Export, and Migration
Upgrading to Microsoft Dynamics AX 2012
Microsoft Dynamics AX 2009
Application Object Server (AOS)
Enterprise Portal and Role Centers
SSRS and SSAS Integration
Hi, I have a requirement to create a SalesLine record next to the selected record in SalesTable form on button click. How do i get a new record next to current record - is there is out of box function that generates appropriate LineNumber ?
Thanks in Advance,San
AX assigns LineNum only if you don't provide any - so just fill it before calling createLine(). The usual value is half of the interval between the current line num and the next one (the distance doesn't have to be 1.00).
Martin "Goshoom" Dráb | Freelancer | Goshoom.NET Dev Blog
I wouldn't advise you to insert the record into salesline manually. However, the salesline table has a special method called "createLine" which handlers a bunch of funtionality that you would otherwise miss when doing the insert manually.
Among other things, it will take care of the line number for you. Just fill in the fields in the SalesLine buffer you have (call initFromXXX() where available and potentially modifiedField() as well for the fields you are filling in). Then instead of insert(), call createLine().
Use this API as it will also give you potential future functionality for free.
Dynamics AX MVP | My Blog | Sikich | Twitter @JorisdG
yep, i am using the same approach but in this way the line number that is generated is reflecting the (LineNumber +1) for the current SalesOrder. But my requirement is that it should be next to selected line , just like how natively it works when user creates a line in SalesTable form.
AX itself is pretty loose about how to assign the line number. I think modification is needed for your specific needs.
My blog | PBC
This forum post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.
thanks Martin and Dolee for confirming that this is not available out of box. I will work on getting this logic in X++.
I agree the line numbers are very loose in AX. Even worse, it's not even enforced to be unique on the database level. I've noticed at clients that have been live for quite a while that typically duplicate numbers for lines start showing up. So on the flip side of this, be careful using the line number for any reporting other than just displaying it :-)
Hi, I have an issue with line numbers on sales orders that i hope you can help me with.
We use the process industries version of AX, and if from a sales line i use the Function / Explode formula function, the original sales line is cancelled and lines are created for its formula lines as follows
after using the explode formula function i get
Line 1.00000000 is cancelled
Line 1.00000001 is created
Line 1.00000002 is created
All this is fine except if you then add another item to the order, the sales line number is calculated as 2.00000002 which is causing me a problem as i need all lines that have not been exploded to be integers so that i can trace back the original sales item.
It won't ever work as you expect unless you change the default behavior - for example, if you insert a line between line 1 and 2, it will get line num 1.5, which is obviously not an integer.
You can adjust the way how line num is assigned in SalesLine.createLine() (= last line num
+ 1), but you still have to cope with the previous point.
Thanks for your response Martin. I will look to change the class to move it to the next integer rather than just adding 1.0 as this should solve our issues.
Other Microsoft Sites
I'm a Customer
I'm a Partner
Follow Microsoft Dynamics