Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

Creating a SalesOrder into Dynamics NAV 2017 using Web Services (SOAP)

Posted on by Microsoft Employee

Error: Unit_of_Measure_Code is readonly yet i want to specify the Unit_of_Measure_Code on sales lines. Nav picks a default one.

*This post is locked for comments

  • Suggested answer
    dkatson Profile Picture
    dkatson 2,263 on at
    RE: Creating a SalesOrder into Dynamics NAV 2017 using Web Services (SOAP)

    According to T37.CanEditUnitOfMeasureCode() - you can edit UoM code if there more than 1 unit of measure for item. If there is 1 uom for item, tan it is not editable.

    Also check that you change "Unit of Measure Code". Because "Unit of Measure" - is description of unit of measure code

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Creating a SalesOrder into Dynamics NAV 2017 using Web Services (SOAP)

    Here is the C# code.

    Also another error is Unit_of_Measure_Code  is read only

    var hh = or.SalesLines[h];

                                       hh.Quantity = decimal.Parse(ce2.quantity.ToString());

                                       hh.Unit_Price = decimal.Parse(ce2.unit_price.ToString());

                                       hh.Unit_PriceSpecified = true;

                                       hh.Type = oNavSalesOrder.Type.Item;                                  

                                       hh.No = ce2.item_no;

                                       hh.Total_Amount_Incl_VATSpecified = true;

                                       hh.Total_Amount_Incl_VAT = decimal.Parse(ce2.line_total.ToString());

                                       hh.Total_Amount_Excl_VATSpecified = true;

                                       hh.Total_Amount_Excl_VAT = decimal.Parse(ce2.line_total.ToString());

                                       hh.TotalSalesLine_Line_AmountSpecified = true;

                                       hh.Total_VAT_AmountSpecified = true;

                                       hh.Total_VAT_Amount = decimal.Parse(ce2.line_total.ToString());

                                       hh.Unit_of_Measure = "Piece";                              

                                       hh.Location_Code = "FG-001";

                                       hh.Unit_of_Measure_Code = ce2.uom_id.ToString();

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,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans