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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

AIF Update Operation Error: No valid document identified from the entity key.

(0) ShareShare
ReportReport
Posted on by 2

Hi,

 

I have created a document service based on a query with the following data sources:

CustTable -> DirOrganization -> PartyLocation -> LogisiticsLocation -> LogisticsPostalAddress (all inner joins except an outer join for DirOrganization -> PartyLocation)

When I try to issue an update operation against the AIF service, I receive the following error:

No valid document identified from the entity key.

I'm using CustTable.AccountNum as the EntityKeyField.

Upon debugging the service code, the error is produced in the method, AxdBaseUpdate.buildStructuredDocumentEntityKey(). The line  this.buildStructuredDocument(_localQuery) results in a NULL 'document'. 

I'm not sure why the above line doesn't return a result? Looking at _localQuery the conditions and joins seem correct and should return a result.

Does anyone have any ideas what is causing the error? Maybe there is a problem with the query?

Thanks,

Nick

 


*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Egljan Profile Picture
    5 on at

    I received the same error, I debugged on the AxdBaseRead/readDocumentList(), On this method the system throws this error  "No valid document identified from the entity key."

    In my case, this error shows up because in AxdBaseRead/serializeQuery() the query that I have used doesn't return any record.

    Maybe you can have the same problem that the query doesn't return any record.

    Verify if the query is correct and can find data in your database.

    Hope this answer will help you,

  • Community Member Profile Picture
    on at

    I received the same error today while transferring some ledger transaction data to a third party application. After a lot of investigation, I found the Endpoint -> Action policy setup was wrong. The EndPoint created for the ledger transfer was correct. But, the same service was wrongly selected in an EndPoint created for Item transfer. Very silly mistake. Transfer started working when I removed the related service from Item transfer related EndPoint.

    I really wish if AX could give more specific errors.

    This might  not be your issue. But, I am updating here in case this extra information will help anyone.

  • Mike N Ike Profile Picture
    305 on at

    In my case, I got this error because the number of keys in my key array on the update() method did not match the number of elements in the array of objects I was trying to update.  Mundane detail....

  • Suggested answer
    Becky Newell Profile Picture
    on at

    Hi Nick,

    Have a look at the post below.  It has a couple examples of how to perform updates against a couple of different services.

    blogs.msdn.com/.../calling-the-update-operation-on-services-in-ax-2012.aspx

    Typically I would suggest doing a read or a find to retrieve the document you want to update, and then with the retrieved object perform your update.

    Becky

  • NR-11010513-0 Profile Picture
    2 on at

     

    namespace TestAIFServiceUpdate

    {

        class Program

        {

            static void Main(string[] args)

            {

                NimbusService.ClientIncAddressServiceClient service = new NimbusService.ClientIncAddressServiceClient();

     

                var client = new NimbusService.AxdClientIncAddress

                {

                    ValidAsOfDateTime = new NimbusService.AxdType_DateTime()

                    {                   

                        Value = DateTime.UtcNow

                    },

                    CustTable = new NimbusService.AxdEntity_CustTable[]

                    {                    

                        new NimbusService.AxdEntity_CustTable()

                        {                                                   

                            Organization = new NimbusService.AxdEntity_Organization_DirOrganization[]

                            {                            

                                new NimbusService.AxdEntity_Organization_DirOrganization()

                                {                         

                                    OrgNumber = "12345",

     

                                    //PartyLocation = new NimbusService.AxdEntity_PartyLocation[]

                                    //{

                                    //    new NimbusService.AxdEntity_PartyLocation()

                                    //    {            

                                    //        LogisticsLocation = new NimbusService.AxdEntity_LogisticsLocation[]

                                    //        {

                                    //            new NimbusService.AxdEntity_LogisticsLocation()

                                    //            {

                                    //                LogisticsPostalAddress = new NimbusService.AxdEntity_LogisticsPostalAddress[]

                                    //                {

                                    //                    new NimbusService.AxdEntity_LogisticsPostalAddress()

                                    //                    {

     

                                    //                    }

                                    //                }

                                    //            }

                                    //        }

                                    //    }

                                    //}

                                }

                            }

                        }

     

                    }

                };

     

     

                NimbusService.EntityKey[] keys = new NimbusService.EntityKey[1];

                NimbusService.KeyField[] keyFields = new NimbusService.KeyField[1];

     

                keyFields[0] = new NimbusService.KeyField();

                keyFields[0].Field = "AccountNum";

                keyFields[0].Value = "000634";

     

     

                keys[0] = new NimbusService.EntityKey();

     

                keys[0].KeyData = keyFields;

     

     

                try

                {

                    service.update(null, keys, client);

                }

                catch (Exception e)

                {

                    System.Console.WriteLine(e.Message);

                }

     

                System.Console.WriteLine("Check AX");

                System.Console.ReadKey();

            }

        }

    }

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

News and Announcements

Season of Giving Solutions is Here!

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
TAHER Mehdi Profile Picture

TAHER Mehdi 3

#2
Martin Dráb Profile Picture

Martin Dráb 2 Most Valuable Professional

#2
Volodya Profile Picture

Volodya 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans