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)

AX error message "Item or category must be specified." when creating a new sales order, because of adding a new integer field to "salesLine" table

(0) ShareShare
ReportReport
Posted on by

Hi everyone,

I've added a new integer field to the "salesLine" table and added some code to some methods of \Forms\SalesTable\DataSources\SalesLine, and this code works properly.

But this caused another problem. When creating a new sales order, I receive an error message indicating that "Item or Category must be specified." And it does not allow me to do anything but to stop the application from task manager and re-start it. I tried to debug the code and found that this matter is because of leaveRecord method in dataSource.

I also understood that this problem happens because of the added field itself (not my code). Because when I deleted the field from table, everything went back to its place.

Could anyone help why this error is being shown and how can I solve it?

Thanks in advance

*This post is locked for comments

I have the same question (0)
  • Dan Emreus Profile Picture
    1,162 on at

    Hi Mernoosh,

    Can you explain a little bit more about your new integer, what is it for?

    /Dan

  • Community Member Profile Picture
    on at

    Sorry, I debugged it again and found that it's because I added a line of code in create() method of salesLine dataSource in salesTable form.

    I've created a class for generating value and adding the value to a field in salesLine dataSource. I want my method to be called after the line is created in the form, so called it after super() in create() method, and this is the cause of the error message.

    Now I must check 2 things. First, fill the field with data when a new sales order is created (because the when a new sales order is created, AX will create a new line, but I didn't find out where.), and then fill the field when a new line is created.

    Can't find the best places to call my method to achieve this.

    Would you please help me in this regard?

    Thanks in  advance

  • Suggested answer
    Dan Emreus Profile Picture
    1,162 on at

    Hi again,

    If you want your code to be called after the line is created I would create a new post event handler subscription on the insert method on table SalesLine and than call your code from there. If possible I prefer putting code in table or classes instead of forms.

    Hope this helps.

    /Dan

  • Community Member Profile Picture
    on at

    My integer field is for generating line numbers. My method receives maximum of line numbers, if existed, newLine = MaxLine+1; otherwise newLine = 1;

    It's something like this.

    I want line number 1 when a new sales order is created, and line number (maxLine + 1) when a new sales line is created. I don't know where to call the method to work properly :(

  • Suggested answer
    Dan Emreus Profile Picture
    1,162 on at

    Hi again,

    There is such a function called in the method createLine, for field LineNum, on table Sales Line. You can do something similar in that method or create a post event handler subscription on the method createLine and than call your code.

    /Dan

  • Community Member Profile Picture
    on at

    Thanks Dan for your help :)

    I'll try that

  • Muhammad Yousaf Profile Picture
    1,339 on at

    Did you find any solution for this problem.... i am facing the same issue, while applying prepayment during PO invoices..

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