web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Where can I find delivery address information of a sales order?

(0) ShareShare
ReportReport
Posted on by

I need to find certain information about a customer from a sales order.

1. Where do I find the delivery address for a sales order (I assume it is stored with customer information). I would need the street name and number, city, state, zip code, and country. I already have the recId for the lineItem. Is there a field in the lineItem that can use to access the table where the delivery information is? Something along the lines of:

RecID_for_deliveryInformation = lineItem.deliveryInfromationRecID; //pull recID for table where delivery info is

 public static SalesLine findByRecId(RecId _recID)
 {   

DeliveryInformation addressInfoLine; //create instance of the table that contains the info

        select firstonly addressInfoLine
            where addressInfoLine.RecId == _RecID_for_deliveryInformation; //pass the recID found from lineItem

        return addressInfoLine;

}

If not, can someone point me in the right direction as to how to do this?

2. Where can I find the ship from information for that same line item?

I appreciate any information that is provided, thank you.

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Community Member Profile Picture
    on at

    hello,

    to return the delivery address you can use the next statement: SalesOrder.DeliveryAddress().Street and all the others fields that you are looking.

    SalesOrder.DeliveryAddress().County, etc.

    And for the ship to you can use the next:

    SalesOrder.ShipCarrierLocation().Street, etc.

    Hope this works for you

  • Community Member Profile Picture
    on at

    By SalesOrder.DeliveryAddress().Street did you mean SalesLine.DeliveryAddress().Street? If not can you tell he how to find the correct SalesOrder from the information stored in the lineItem?

  • Verified answer
    Community Member Profile Picture
    on at

    sure, the sales line has the same method also.

    :)

  • Community Member Profile Picture
    on at

    Thank you so much, I got the address information. I have another question and I hope you can help. I've made a previous post but nobody has answered me on this.

    Right now I have the recID for the line item because is hard coded it. Is there a way to pull that information from the sales order page or from the page where you are creating the sales order and adding line items?

    The way I found my recId was setting a breakpoint in the calc() method in trade totals, then looking at the populated fields. I looked for the lineItem recID in the debugger. This is a short term solution, but I need to somehow grab the RecIDs from specific line items of my choosing, because I need them for my post event handler.

  • Community Member Profile Picture
    on at

    where do you have your post event in the salesLine or where?

    let me see if I understand, you want to get the recId from the sales line, to used it in the post event?

    What are you trying to do?

    I will do my best to help you.

  • Community Member Profile Picture
    on at

    In short, yes you do understand.

    I want to pull information from a sales order, and map the fields that I need to my ErpRequest Object. Then I want to use Json to stringify that Request and send it through an HTTP call to another server. As of now, I have created my ErpReqeust object with the getters and setters. I have successfully mapped all of the information that I need, (the only information I didn't have was the address information, which I just took care of with your help, thanks again). I also have sent that information successfully by Stringifying it with Json and received it on the other server. However, all this was done by hard coding the RecId of the line item that I wanted to send in my Post Event Handler. I need to somehow obtain that information in my post handler. Or, if not the recID, some other unique identifier of the particular sales order.

    As a follow up, because I'm new to developing in with AX, if a sales order has multiple line items associated, is there something like a salesOrder Id which contains all of the line items that I can pull instead. I noticed on the debugger there was another table called OrderTable. Maybe if its better, I could just pull OrderTable's RecID to the Post Event Handler. Then get item RecIDs from that table within my Post Event Handler. In either case, I don't know how to obtain either (SalesLine or OrderTable) RecIDs in the Post Handler. Also the method that the Post Handler is triggered by is a void method, therefore I cant pass any arguments over to my Post Handler.

    I hope this clears things up, it might still be confusing. Any feedback to any aspect would be much appreciated.

  • Community Member Profile Picture
    on at

    Also the SalesLine.ShipCarrierLocation().Street does not work, the deliveryAddress does

  • Community Member Profile Picture
    on at

    I have an example but I need to search for it.

    let me do that for you

  • Community Member Profile Picture
    on at

    Great! Thank you so much. Ill periodically check the forum

  • Community Member Profile Picture
    on at

    First you need to create the eventHandler class:

    6874.Method.png

    next the method to return:

    6874.Method.png

    and next call this class and method in the event Handler in your table or class.

    is that clear?

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans