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

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Finding the correct record in the table Address table from Sales Order

(0) ShareShare
ReportReport
Posted on by

Hi,

I am trying to pick out some fields from the Address table which are related to a sales order and I'm struggling to find the relationship and how to bring up the correct fields in my form.

As an Example say you have SO which has a delivery address. The Address table has the field phone and I'd like to display this on my form for the address selected in the SO.

However there can be multiple addresses with the same value in the "address" field, how would I pick up the correct one? I can't seem to find the unique relationship between the two.

 

Thanks

-Howard

*This post is locked for comments

I have the same question (0)
  • Martin Dráb Profile Picture
    235,796 Most Valuable Professional on at
    Re: Finding the correct record in the table Address table from Sales Order

    @HowardWebb: AddressRefTableId and AddressRefRecId contains actual TableId and Recid, not a reference to AddrTableId and AddrRecId fields.

    It can be a record from either Address or CustTable.

    @Kent: Although SalesTable as a database object has a reference to just one address, sales order as a logical object can have several delivery addresses, because each line can be send to a different address.

    And a primary delivery address from CustTable is just a default value and doesn't have to be used for a particular sales order.

  • Suggested answer
    Community Member Profile Picture
    on at
    Re: Finding the correct record in the table Address table from Sales Order

    DeliveryAddress is copied over from Address table.  The methods you mentioned.  There is a 1:1 on this because salesTable only has one dlv address.

    Question is why are you going from address table to salesTable?  

    All addresses link back to global address book...  Take the salestable, link it back to the customer and then link the customer to the address table.  AddrTableId is 77(custTable) with your customer recId being addrRecId.

    I'm sure there is another way to do this but SalesTable does not have a DeliveryAddressPhone field.  What you can do is modify SalesTable to include this field and then copy the values over in the setAddress / initFromCustTable methods.

    Hope this helps... somewhat.

  • Community Member Profile Picture
    on at
    Re: Finding the correct record in the table Address table from Sales Order

    Thanks for the reply - and sorry for the delay. Firefox was having issues with the site!

    Looking at the address table I can see that there are multiple lines with the same values in "AddrRecId" and "AddrTableId" as finding the first will not do I need to somehow find the one and only record that is linked to the SO. Looking at SalesTable I can see that there is a method called "setAddress" which seems to map the AddressRefRecId to the RecId on the Address table. But I can see some records that don't fit. I might have some junk data as there has been a lot of work in this area. Am I on the right path?

    Thanks again!

  • Suggested answer
    Martin Dráb Profile Picture
    235,796 Most Valuable Professional on at
    Re: Finding the correct record in the table Address table from Sales Order

    There is a relation over SalesTable.AddressRefTableId and SalesTable.AddressRefRecId fields. But don't forget that the same exists on SalesLine level too (for shipments to multiple addresses).

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…

Mansi Soni – Community Spotlight

We are honored to recognize Mansi Soni as our August 2025 Community…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Syed Haris Shah Profile Picture

Syed Haris Shah 9

#2
Mea_ Profile Picture

Mea_ 4

#3
KP-31070522-0 Profile Picture

KP-31070522-0 3

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans