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)

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,089 on at

    Hi 

    Compile the RetailSalesOrderCalculator object once and check.

    Thank you

  • André Arnaud de Calavon Profile Picture
    301,053 Super User 2025 Season 2 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

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