D365FFO – AX – Updating Vendor Address using X++


Vendor address state value can be retrieved from tables VendTable, DirPartyTable, DirPartyLocation, LogisticsLocation and LogisticsPostalAddress (or) through the view DirPartyPostalAddressView(mentioned in the blogs suggested by Vilmos)

You can use the following job(query) to get the data and to update the state:
static void VendorState(Args _args)
VendTable vendTable;
DirPartyTable dirPartyTable;
DirPartyLocation dirPartyLocation;
LogisticsLocation logisticsLocation;
LogisticsPostalAddress logisticsPostalAddress;
LogisticsAddressState LogisticsAddressState;

while select vendTable
where vendTable.AccountNum == “Vend1” // Vendor
join dirPartyTable
where vendTable.Party == dirPartyTable.RecId
join dirPartyLocation
where dirPartyLocation.Party == dirPartyTable.RecId
&& dirPartyLocation.IsPostalAddress == true
//&& dirPartyLocation.IsPrimary == true // To get primary address
join logisticsLocation
where logisticsLocation.RecId == dirPartyLocation.Location
&& logisticsLocation.Description == “AddressDescription” // Address description
join logisticsPostalAddress
where logisticsPostalAddress.Location == dirPartyLocation.Location
// Older state
info(strFmt(“State: %1”, logisticsPostalAddress.State));

// Newer state – Check on the new state
if (LogisticsAddressState::exist(logisticsPostalAddress.CountryRegionId, “NewState”))
logisticsPostalAddress.ValidTimeStateUpdateMode (ValidTimeStateUpdate::Correction);
logisticsPostalAddress.State = “NewState”;



Inserisci i tuoi dati qui sotto o clicca su un'icona per effettuare l'accesso:

Logo di WordPress.com

Stai commentando usando il tuo account WordPress.com. Chiudi sessione /  Modifica )

Google photo

Stai commentando usando il tuo account Google. Chiudi sessione /  Modifica )

Foto Twitter

Stai commentando usando il tuo account Twitter. Chiudi sessione /  Modifica )

Foto di Facebook

Stai commentando usando il tuo account Facebook. Chiudi sessione /  Modifica )

Connessione a %s...