Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

Post a SalesOrder (Ship and Invoice also) from C#

Posted on by Microsoft Employee

Any one with a C# sample code on how i can post a sales order that already exists in Dynamics NAV in C# ?

*This post is locked for comments

  • HoangNam Profile Picture
    HoangNam 315 on at
    RE: Post a SalesOrder (Ship and Invoice also) from C#

    You're welcome.

    And, please verify the answer to help other peoples.

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Post a SalesOrder (Ship and Invoice also) from C#

    Hello Nam.

    You are a genius. It has worked like charm!!!

    Come for coffee. dicky.tech@gmail.com

  • Verified answer
    HoangNam Profile Picture
    HoangNam 315 on at
    RE: Post a SalesOrder (Ship and Invoice also) from C#

    Hi Muleso,

    IT is a property of function.

    You can open Properties of that function and change value to No. Default is Yes.

    Then, update WS on C# again. You can use that function. Note Web Service Name of Page and Codeunit must be the same.

    WS.jpg

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Post a SalesOrder (Ship and Invoice also) from C#

    Hi Nam,

    This is my Extended code unit, how can remove 'LOCAL' from the PostOrder function seems that's the issue/

    Documentation()

    OnRun()

    LOCAL PostOrder(Order : Record "Sales Header")

    Order.Invoice:=TRUE;

    Order.Ship:=TRUE;

    CODEUNIT.RUN(CODEUNIT::"Sales-Post", Order);

  • Suggested answer
    HoangNam Profile Picture
    HoangNam 315 on at
    RE: Post a SalesOrder (Ship and Invoice also) from C#

    Hi Muleso,

    Please reference this link:

    https://blogs.msdn.microsoft.com/freddyk/2009/11/17/extending-page-web-services-and-creating-a-sales-order-again/

    I'm successful for posting SO from C# via Web Service with this link.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Post a SalesOrder (Ship and Invoice also) from C#

    The new code unit 8000 . Still doesn't work. Am using NAV 2017.

    Documentation()

    OnRun()

    LOCAL PostOrder(Order : Record "Sales Header")

    Order.Invoice:=TRUE;

    Order.Ship:=TRUE;

    CODEUNIT.RUN(CODEUNIT::"Sales-Post (Yes/No)", Order);

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Post a SalesOrder (Ship and Invoice also) from C#

    Hello,

    Imagine it's NOT working.

    I have created a new code unit, executing 81 and still when i expose it on web service and reference on C#, i can execute.

  • Suggested answer
    Alexander Ermakov Profile Picture
    Alexander Ermakov 28,094 on at
    RE: Post a SalesOrder (Ship and Invoice also) from C#

    This might be also helpful: dynamicsuser.net/.../post-purchase-order-from-web-service

  • Suggested answer
    Suresh Kulla Profile Picture
    Suresh Kulla 43,745 on at
    RE: Post a SalesOrder (Ship and Invoice also) from C#

    Try to use codeunit 80 or create extended as described in the article.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Post a SalesOrder (Ship and Invoice also) from C#

    Seems when i expose my code units CANNOT execute post.

    Code unit 81 exposes below.

    <?xml version="1.0"?>

    -<definitions xmlns:tns="urn:microsoft-dynamics-schemas/codeunit/oSalesPostYesNo" xmlns="schemas.xmlsoap.org/.../" targetNamespace="urn:microsoft-dynamics-schemas/codeunit/oSalesPostYesNo">

    -<types>

    <schema xmlns="www.w3.org/.../XMLSchema" targetNamespace="urn:microsoft-dynamics-schemas/codeunit/oSalesPostYesNo" elementFormDefault="qualified"/>

    </types>

    <portType name="oSalesPostYesNo_Port"/>

    -<binding name="oSalesPostYesNo_Binding" type="tns:oSalesPostYesNo_Port">

    <binding xmlns="schemas.xmlsoap.org/.../" transport="schemas.xmlsoap.org/.../http"/>

    </binding>

    -<service name="oSalesPostYesNo">

    -<port name="oSalesPostYesNo_Port" binding="tns:oSalesPostYesNo_Binding">

    <address xmlns="schemas.xmlsoap.org/.../" location="desktop-5hfj3o6/.../oSalesPostYesNo"/>

    </port>

    </service>

    </definitions>

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