Skip to main content

Notifications

Microsoft Dynamics NAV (Archived)

Sales Header - Shipping ADDRESS Change

Posted on by 330

Can anybody tell why this is not working - No Error (Using this via Web service) - Ship to option already custom

UpdateShipAddress(InSONo : Text[30];InShipName : Text[30];InShipAddress1 : Text[30];InShipAddress2 : Text[30];InShipCity : Text[30];InShipCounty : Text[30];InShipPostcode : Text[30])
Order.SETFILTER("No.",InSONo);
Order.FINDFIRST;
Order."Ship-to Code" := '';
Order."Ship-to Name" :=InShipName;
Order."Ship-to Address" :=InShipAddress1;
Order."Ship-to Address 2" :=InShipAddress2;
Order."Ship-to City" :=InShipCity;
Order."Ship-to County" :=InShipCounty;
Order."Ship-to Post Code" :=InShipPostcode;
Order.MODIFY;

*This post is locked for comments

  • Suggested answer
    CharithSilva Profile Picture
    CharithSilva 330 on at
    RE: Sales Header - Shipping ADDRESS Change

    Hi Kimo,

    I changed the code in the sales header page to set to shipto option to alternative address

    42 Sales order -added code set custom address on below methods

    OnAfterGetRecord()/OnNewRecord(BelowxRec : Boolean)/ OnInsertRecord(BelowxRec : Boolean) : Boolean/Sell-to Customer Name - OnValidate()

    ShipToOptions:=ShipToOptions::"Custom Address";

    and added function to update address as below

    UpdateShipAddress(InSONo : Text[30];InShipName : Text[30];InShipAddress1 : Text[30];InShipAddress2 : Text[30];InShipCity : Text[30];InShipCounty : Text[30];InShipPostcode : Text[30])

    Order.SETFILTER("No.",InSONo);

    Order.FINDFIRST;

    Order."Ship-to Code" := '';

    Order."Ship-to Name" :=InShipName;

    Order."Ship-to Address" :=InShipAddress1;

    Order."Ship-to Address 2" :=InShipAddress2;

    Order."Ship-to City" :=InShipCity;

    Order."Ship-to County" :=InShipCounty;

    Order."Ship-to Post Code" :=InShipPostcode;

    Order.MODIFY;

    didnt find any other better solutions. this works for me

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Sales Header - Shipping ADDRESS Change

    Hi Charith, How did you set the ship to option to 'custom' via web service? I tried to  use C# to set salesOrder.shippingOptions = "custom address", but it doesn't work.

  • Verified answer
    CharithSilva Profile Picture
    CharithSilva 330 on at
    RE: Sales Header - Shipping ADDRESS Change

    Hi Amol,

    ERRRRR.....Its working fine, Nav service needed a restart....!!!!!

    Sorrry for the trouble

  • CharithSilva Profile Picture
    CharithSilva 330 on at
    RE: Sales Header - Shipping ADDRESS Change

    Hi Amol,

    There is no error at all, It just not chaning the field values. Im wondering code is wrong eventhough it dosnt show any compile errors.

  • Suggested answer
    Amol Salvi Profile Picture
    Amol Salvi 18,694 on at
    RE: Sales Header - Shipping ADDRESS Change

    What is the error it is giving ? Kindly provide more information for error you are getting.

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!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans