2

I have to set the InventLocation Address by code. By code I know how to find the InventLocation address, but if it isn't there I want to create it.

My code is this :

InventLocation   invLocationTable;
LogisticsPostalAddress logisticsPostalAddress;

invLocationTable  = InventLocation::find(MYinvLocationId);
logisticsPostalAddress = LogisticsLocationEntity::findPostalAddress(invLocationTable, LogisticsLocationRoleType::None);

if (!logisticsPostalAddress )
{
 // Here I want to create/set the InventLocation adress, but I don't know how to do it.
}

Is it possible to create it?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
ulisses
  • 1,549
  • 3
  • 37
  • 85

1 Answers1

0

Your InventLocation.RecId will need to be referenced in InventLocationLogisticsLocation.Location, so obviously this table will need to have a record inserted. The next reference will be in InventLocationLogisticsLocationRole.LocationLogisticsLocation, again you will need a record. Finally, the reference in LogisticsPostalAddress.Location.

So first insert into InventLocationLogisticsLocation, then into InventLocationLogisticsLocationRole, finally into LogisticsPostalAddress.

Also make sure that you have a Role Type defined as None, otherwise you might be missing the record in LocationPostalAddress.

Kevin Kabatra
  • 122
  • 2
  • 13