How can I create a postal address for a non party enity like inventlocation?
*This post is locked for comments
How can I create a postal address for a non party enity like inventlocation?
*This post is locked for comments
Now here is my solution.
LogisticsEntityLocationMap entityPartyLocationMap;
container locationRoles, roles;
LogisticsPostalAddressEntity logisticpostalentity;
LogisticsPostalAddressView postalAddress;
postalAddress.Street = 'Hauptstrasse';
postalAddress.City = 'Treuen';
postalAddress.State = '';
postalAddress.ZipCode = '08233';
postalAddress.CountryRegionId = 'DEU';
postalAddress.LocationName = '1234';
logisticpostalentity = new LogisticsPostalAddressEntity();
address = logisticpostalentity.createPostalAddress(postalAddress);
entityPartyLocationMap = LogisticsEntityLocationMap::find(
tableNum(InventLocationLogisticsLocation),
InventLocation::find(_projid).RecId,address.Location);
entityPartyLocationMap.Entity = InventLocation::find('1234').RecId;
entityPartyLocationMap.Location = address.Location;
entityPartyLocationMap.IsPostalAddress = NoYes::Yes;
entityPartyLocationMap.IsPrimary = NoYes::No;
entityPartyLocationMap.IsPrivate = NoYes::No;
entityPartyLocationMap.ValidFrom = DateTimeUtil::utcNow();
entityPartyLocationMap.ValidTo = DateTimeUtil::maxValue();
LocationRoleMap = LogisticsLocationEntity::getDefaultLocationRoleFromEntity
(tableName2id("InventLocation"));
locationRoles = map2Con(LocationRoleMap);
roles = conpeek(locationRoles, 1);
// create/update location entity and write roles
entityPartyLocationMap.addEntityLocation(roles ,true);
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... 291,280 Super User 2024 Season 2
Martin Dráb 230,235 Most Valuable Professional
nmaenpaa 101,156