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
@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.
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.
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!
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).
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 290,782 Super User 2024 Season 2
Martin Dráb 229,067 Most Valuable Professional
nmaenpaa 101,150