Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Suggested answer

How can I get ShipTo_AddressId from an order? I need to read another address field.

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

MSDYN added a field to the customer address for Dual Write.  I'm hoping to get it on the client but, ship to address is not a lookkup.  It's a composite.  I need the ShipTo_AddressId to run a retrieveRecord.  Since it is not there, how do I get the customeraddressid or extended data from an order's ship to address using XRM.page/webapi?

TIA

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How can I get ShipTo_AddressId from an order? I need to read another address field.

    I ruled that out because I believe it would require a save of the salesorder before it would be accurate -- old or not yet gathered shipto.

    In fact I am going to solve my challenge with a plugin because if it has to be on save, why mess with client side junk.

  • Suggested answer
    a33ik Profile Picture
    a33ik 84,325 Most Valuable Professional on at
    RE: How can I get ShipTo_AddressId from an order? I need to read another address field.

    Hello,

    Have you tried something like:

    Xrm.WebApi.retrieveRecord("salesorder", salesOrderId, "?$select=shipto_addressid").then(

       function (result) {

           alert(result.shipto_addressid);

       },

       function (error) {

           console.log(error.message);

       }

    );

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How can I get ShipTo_AddressId from an order? I need to read another address field.

    Thank you but, no.  shipto addressID is what I'm after.  Or the msdyn_locationid.  Neither are part of the composite.

  • Charan Raju C R Profile Picture
    Charan Raju C R 7 Super User 2024 Season 1 on at
    RE: How can I get ShipTo_AddressId from an order? I need to read another address field.

    Hi,

    If I have correctly understood your requirement, you are trying to fetch 'Ship To Address' on Sales Order form using client side script. You can get this Ship To Composite address field value using either of below two javascript statements.

    Xrm.Page.getAttribute("shipto_composite").getValue();

    Xrm.WebApi.retrieveRecord("salesorder", salesOrderId, "?$select=shipto_composite").then(
        function success(result) {
            alert(result.shipto_composite);
        },
        function (error) {
            console.log(error.message);
        }
    );

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! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,458 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans