Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

AIF: Update sales order error: Entity update mode must be specified

Posted on by 1,169

Hi all,

Greetings!

I could use some help here.

I am trying to update a sales order using its document service.

When I try the code mentioned here (or my own code for that matter) I get "Entity update mode must be specified".

I am not sure where to mention the updateMode.

            SalesOrderDocuService.KeyField keyField = new SalesOrderDocuService.KeyField() { Field = "SalesId", Value = _salesId };

            SalesOrderDocuService.EntityKey entityKey = new SalesOrderDocuService.EntityKey();

            entityKey.KeyData = new SalesOrderDocuService.KeyField[1] { keyField };

            SalesOrderDocuService.EntityKey[] entityKeys = new SalesOrderDocuService.EntityKey[1] { entityKey };

            SalesOrderDocuService.SCA_AxdSalesOrderServiceClient _Client;

            using (_Client = new SalesOrderDocuService.SCA_AxdSalesOrderServiceClient())
            {

                SalesOrderDocuService.CallContext _callContext = new SalesOrderDocuService.CallContext();

                _callContext.Company = axCompanyName;

                SalesOrderDocuService.AxdSCA_AxdSalesOrder _SalesOrderList = _Client.read(_callContext, entityKeys);

                SalesOrderDocuService.AxdEntity_SalesTable _SalesOrderTable = _SalesOrderList.SalesTable.First();

                SalesOrderDocuService.AxdEntity_SalesLine SalesLine = _SalesOrderTable.SalesLine.First();

                decimal newQty = 3;

                SalesLine.SalesQty = newQty;

                _Client.update(_callContext, entityKeys, _SalesOrderList);

            }


Regards,

Abhinay

*This post is locked for comments

  • Abhinay Tharwal Profile Picture
    Abhinay Tharwal 1,169 on at
    RE: AIF: Update sales order error: Entity update mode must be specified

    Hi,

    I think an update will not be possible for a document service with views in it.

    I will try that with a custom service.

    Regards,

    Abhinay

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans