web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Limit the lines in the sales order

(0) ShareShare
ReportReport
Posted on by
Hello everyone, I am writing to see how I can limit the lines of sales orders to only 23 lines,
for tax issues of the country where this and the size of the format, now there is some class, method,
form class or another thing where I can look to develop the above mentioned? thank you regards

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Satish Panwar Profile Picture
    14,671 Moderator on at

    Hi Ernie,

    Standard AX doesn't allow the restriction on number of lines. What you can do is add a parameterized field that will hold your maximum number of lines (.e.g. 23). In sales line, when initvalue method is called, you can try to find out how many lines already exist, if greater than 23, don't proceed with line creation and throw message "maximum number of allowed lines is X". Hope this helps.

  • Suggested answer
    Ludwig Reinhard Profile Picture
    Microsoft Employee on at

    Hello Ernie,

    In addition to the modification that Satish already mentioned there is another thing that you have to consider.

    This other 'thing' is the AR parameter that specifies how to deal with already invoiced orders.

    In the AR parameters in the update section there is a parameter that allows modifying already invoiced orders.

    You can prevent or allow that.

    This is something you must also take into consideration if you make your code adjustment.

    Best regards,

    Ludwig

  • eduran15 Profile Picture
    39 on at

    Ok I understand, now that parameterized field I add to the form? or the Initvalue method, if your idea sounds good to me, I will validate and comment on my results

    Thank you so much, Satish

    Best regards

  • eduran15 Profile Picture
    39 on at

    One question I have seen said parameter but I can not remember where?, please could you indicate the path to the AR parameter?

    Thank you so much

    best regards

  • eduran15 Profile Picture
    39 on at

    Ready and I found what you said thank you very much

    Best Regards

  • Suggested answer
    Satish Panwar Profile Picture
    14,671 Moderator on at

    Hi Eduran,

    Please let us know if there are any other question you have. If not, please help verify the answers if they were helpful to you so other community members can benefit from it as well.

  • eduran15 Profile Picture
    39 on at
    Hi everyone
    Well the answer helped me however I have more questions, in this case I put a parameterized field 
    called LineNum to this I put an IF that when it reaches 23 lines indicates me a message but it still does not
    work, I do not know if I put a counter or another What would I miss? this is placed in the SalesTable form
    and the method adds it to the field method regards
  • Suggested answer
    Satish Panwar Profile Picture
    14,671 Moderator on at

    Glad that you found answers helpful...Here is how you should implement it.

    1. Create a parameter in AR parameters that will hold your max line count.. If you created this at order level, that's fine as well, this can help you decide on order by order basis.

    2. On sales line, when you create a new line, initvalue() method is called, out there you should do something like this:

    select count(SalesId) from salesTable where salesTable.SalesId = this.salesid;

    if salesTable.SalesId > max count from the AR parameters or salesTable

    (throw error)

    else

    allow the method to continue. You need to translate this into your codebase.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans