Skip to main content

Notifications

Announcements

No record found.

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

  • Suggested answer
    Egljan Profile Picture
    Egljan 5 on at
    RE: AIF Update Operation Error: No valid document identified from the entity key.

    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
    Community Member Microsoft Employee on at
    RE: AIF Update Operation Error: No valid document identified from the entity key.

    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
    Mike N Ike 305 on at
    RE: AIF Update Operation Error: No valid document identified from the entity key.

    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
    Becky Newell on at
    Re: AIF Update Operation Error: No valid document identified from the entity key.

    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
    NR-11010513-0 2 on at
    Re: AIF Update Operation Error: No valid document identified from the entity key.

     

    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

Quick Links

Congratulations 2024 Spotlight Honorees!

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December!

Congratulations to our December super stars! 🥳

Get Started Blogging in the Community

Hosted or syndicated blogging is available! ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,622 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,354 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans