Obtaining selected Delivery address record from sales order  Topic is solved

Discussions relating to Jiwa 7 plugin development, and the Jiwa 7 API.

Obtaining selected Delivery address record from sales order

Postby indikad » Wed May 04, 2016 12:31 pm

I am on sales order screen using the SalesOrderHistory object on the sales order SaveStart event
user has selected a NON default delivery address.
I need to to obtain the "EDI Store Location Code" value ( This field - that is on debtor master deliver address tab ) for the selected delivery address.

However , the SalesOrderHistory does not contain that value , it contains Address 1 , Address 2 etc but not this one.

I am currently querying the DB_DeliveryAddress table based on the selected Address 1 - but this is not the best outcome for me as I have to restrict the user from editing the Address 1 field on sales order

any ideas ?
indikad
Frequent Contributor
Frequent Contributor
 
Posts: 182
Joined: Thu Jun 18, 2009 1:14 pm
Topics Solved: 2

Re: Obtaining selected Delivery address record from sales or  Topic is solved

Postby Scott.Pearce » Wed May 04, 2016 1:01 pm

It doesn't look like there is a tight link from sales order delivery address to debtor delivery address - a delivery address is selected from the lookup, and then denormalised into the sales order history table. Further, as you noted, the delivery address on the sales order can be changed to be any arbitrarily address!

What if you stored the DB_DeliveryAddress.DeliveryID in a Sales Order History custom field? Upon SO Create End, sql read in the DB_DeliveryAddress.DeliveryID for the default delivery address for the debtor. If _SalesOrder.SalesOrderHistorys(_SalesOrder.SelectedHistoryNo).DelAddress1 ever changes, attempt to read DB_DeliveryAddress.DeliveryID based on DebtorID and Address1. If a DB_DeliveryAddress.DeliveryID is found, update the custom field. If it is not found, then user must have overtyped the address1 - the existing custom field value is still valid and should remain untouched.

When you want to get the EDI Store Location Code, use the DeliveryAddress entity (JiwaFinancials.Jiwa.JiwaApplication.Entities.Debtor.DeliveryAddress) - .ReadRecord() based on your custom field value, then look at the .EDIStoreLocationCode property of the entity.
Scott Pearce
Senior Analyst/Programmer
Jiwa Financials
User avatar
Scott.Pearce
Senpai
Senpai
 
Posts: 765
Joined: Tue Feb 12, 2008 11:27 am
Location: New South Wales, Australia
Topics Solved: 230

Re: Obtaining selected Delivery address record from sales or

Postby indikad » Wed May 04, 2016 1:23 pm

Hi Scott,
<< JiwaFinancials.Jiwa.JiwaApplication.Entities.Debtor.DeliveryAddress) - .ReadRecord() >>
Thanks for the above - reminds me

the salesoder.debtor extension gives me the EDI Store Location ID at any time - so I wont need to save it in a custom field - (but that is from the Debtor Default address record and NOT what the sales order carries).
I currently achieve your way but using a SQL query checking DB_DeliveryAddress DB
(WHERE DB.AccountNo = 'account01' AND DA.Address1 = 'someaddress '

I guess the way its wired if the user is allowed to change Address fields on the sales order it wont make sense for you to keep a tight link.
indikad
Frequent Contributor
Frequent Contributor
 
Posts: 182
Joined: Thu Jun 18, 2009 1:14 pm
Topics Solved: 2


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 6 guests