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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Error executing code: The field with ID '0' does not exist in table ''.

(0) ShareShare
ReportReport
Posted on by 1,214

Hi,

I got this error whenever I'm trying to add or edit SalesLine record in SalesTable form.

When I debug, this error always comes from fixCurrentLineInRetailTmpOrderItem method in RetailSalesOrderCalculator class. The highlighted line is where the error being triggered:

private void fixCurrentLineInRetailTmpOrderItem()
    {
        UserId userId = curUserId();
        ItemId currentItemId = currentSalesLine.ItemId;
        RetailValidationId currentRetailVariantId = currentSalesLine.RetailVariantId;

        // The current sales line may not have been saved yet.
        if (currentRetailVariantId)
        {
            select firstOnly RecId from tempOrderItem
                where tempOrderItem.ItemId == currentItemId
                    && tempOrderItem.retailVariantId == currentRetailVariantId;
            
            if (!tempOrderItem)
            {
                tempOrderItem.clear();
                tempOrderItem.ItemId = currentItemId;
                tempOrderItem.retailVariantId = currentRetailVariantId;
                
                tempOrderItem.insert();
            }
        }
        else if (currentItemId)
        {
            select firstOnly RecId from tempOrderItem
                where tempOrderItem.ItemId == currentItemId;
            
            if (!tempOrderItem)
            {
                tempOrderItem.clear();
                tempOrderItem.ItemId = currentItemId;
                
                tempOrderItem.insert();
            }
        }
    }

I don't understand what's wrong with that line since tempOrderItem.retailVariantId and salesLine.RetailVariantId is the same data type. And I don't see any mapping problem either since these two fields are standard fields and mappings are already added accordingly. 

I have run out of ways to tackle this problem. Please help.

Thank You.

*This post is locked for comments

I have the same question (0)
  • Guruprasanna Profile Picture
    1,093 on at

    Hi 

    Compile the RetailSalesOrderCalculator object once and check.

    Thank you

  • André Arnaud de Calavon Profile Picture
    304,291 Super User 2026 Season 1 on at

    Hi Hairul,

    Try to start a full build and database sync. Do you have installed additional models or packages in this environment? Any customizations? If you installed a deployable package where objects are overlayered, you will also need the models to be installed; otherwise the build can fail, but at least similar behavior can occur.

  • Suggested answer
    Agha SirajulDola Profile Picture
    555 on at

    Quickest Possible solution is to 'Restart services of Dynamics AX'.    

  • Verified answer
    HAIRUL HAZRI Profile Picture
    1,214 on at

    Hi everyone,

    thanks for answering.

    Apparently, there's something wrong with our development environment related to hotfix or so I heard. I don't know much about the details, but our colleague created a new environment for us to use and naturally the issue is gone.

    Regards.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
CP04-islander Profile Picture

CP04-islander 26

#2
imran ul haq Profile Picture

imran ul haq 8

#3
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 4 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans