我必须按代码设置InventLocation 地址。 通过代码,我知道如何找到InventLocation地址,但如果不存在,我想创建它。
我的代码是:
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.
}
是否可以创建它?
答案 0 :(得分:0)
您的InventLocation.RecId需要在InventLocationLogisticsLocation.Location中引用,因此显然此表需要插入一条记录。下一个参考将在InventLocationLogisticsLocationRole.LocationLogisticsLocation中,您将需要一个记录。最后,在LogisticsPostalAddress.Location中引用。
首先插入InventLocationLogisticsLocation,然后插入InventLocationLogisticsLocationRole,最后插入LogisticsPostalAddress。
还要确保您将角色类型定义为None,否则您可能会错过LocationPostalAddress中的记录。