Acumatica-如何从客户的自定义字段更新客户位置中的自定义字段



我尝试了几种不同的方法来实现这一点,但每种方法都有一段我做得不对的代码。如果在"客户交付"选项卡中更新了自定义字段UsrCustomerShipAccount,我需要更新该字段。我尝试了SetValueExt并创建了一个图形实例。对这个愚蠢的问题感到抱歉。似乎让我最接近的方式如下:

protected void LocationExtAddress_UsrCustomerShipAccnt_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e, PXFieldUpdated InvokeBaseHandler)
{
if(InvokeBaseHandler != null)
InvokeBaseHandler(cache, e);
var row = (LocationExtAddress)e.Row;
if (row == null) return;
PXSelectBase<Location> locationObj = new PXSelect<Location, Where<Location.bAccountID, Equal<Required<Location.bAccountID>>>>(Base);
Location deliveryLocation = locationObj.Select(row.LocationBAccountID);
var locationExt = PXCache<Location>.GetExtension<LocationExt>(location);  <-- This generates error that there is no LocationExt.
deliveryLocation.Cache.SetValueExt(deliveryLocation, "UsrCustomerShipAccount", -->This needs to be the value that changed LocationExtAddress.UsrCustomerShipAccount but I don't see how to get this<--);
deliveryLocation.Cache.IsDirty = true;
deliveryLocation.Update(deliveryLocation);  <--I don't know if this doesn't work because it is wrong or if it is because "UsrCustomerShipAccount" is not in deliverLocation.
}

您有

var locationExt = PXCache<Location>.GetExtension<LocationExt>(location);

这不是吗

var locationExt = PXCache<Location>.GetExtension<LocationExt>(deliveryLocation );

最新更新