Con questo job è possibile creare un indirizzo (a partire da un indirizzo associato ad un site) e collegarlo ad un magazzino. Questo job è stato di grande aiuto:
http://axcorner.blogspot.com/2014/01/create-warehouse-addresses-through-code.html
public static void main(Args _args)
{
InventSite inventSite;
InventLocation inventLocation;
InventSiteId inventSiteid = "K1"; //sito di partenza
InventLocationId inventLocationId = "lil01"; //magazzino su cui creare l'indirizzo
LogisticsPostalAddress postalAddress;
LogisticsPostalAddressView postalAddressView;
LogisticsPostalAddress logisticsPostalAddressSite;
LogisticsEntityLocationMap locationMap;
container role, roleMap;
Map LocationRoleMap;
LogisticsLocation logisticsLocation;
LogisticsElectronicAddress LogisticsElectronicAddress;
inventSite = inventSite::find(inventSiteid);
inventLocation = inventLocation::find(inventLocationId);
//quì prendo l'indirizzo sorgente del site
logisticsPostalAddressSite = inventSite.logisticsPostalAddress();
logisticsLocation = LogisticsLocation::find(logisticsPostalAddressSite.Location);
LogisticsElectronicAddress::findByLocation(logisticsLocation.RecId);
LogisticsPostalAddressEntity postalAddressEntity = new LogisticsPostalAddressEntity();
postalAddressView.Street = logisticsPostalAddressSite.Street;
postalAddressView.City = logisticsPostalAddressSite.City;
postalAddressView.State = logisticsPostalAddressSite.State;
postalAddressView.ZipCode = logisticsPostalAddressSite.ZipCode;
postalAddressView.CountryRegionId = logisticsPostalAddressSite.CountryRegionId;
postalAddressView.LocationName = logisticsLocation.Description;
postalAddress = postalAddressEntity.createPostalAddress(postalAddressView);
locationMap.initValue();
locationMap = LogisticsEntityLocationMap::find(tableNum(InventLocationLogisticsLocation), inventLocation.RecId, postalAddress.Location);
locationMap.Entity = inventLocation.RecId;
locationMap.Location = postalAddress.Location;
locationMap.IsPostalAddress = logisticsLocation.IsPostalAddress;
locationMap.IsPrimary = LogisticsElectronicAddress.IsPrimary;
locationMap.IsPrivate = LogisticsElectronicAddress.IsPrivate;
LocationRoleMap = LogisticsLocationEntity::getDefaultLocationRoleFromEntity(tableNum(InventLocation));
roleMap = map2Con(LocationRoleMap);
role = conpeek(roleMap, 1);
locationMap.addEntityLocation(role ,true);
info("Terminato");
}