【问题标题】:Acumatica - How to update custom field in Customer Location from custom field in CustomerAcumatica - 如何从客户中的自定义字段更新客户位置中的自定义字段
【发布时间】:2020-04-01 23:15:06
【问题描述】:

我尝试了几种不同的方法来做到这一点,每种方法都有一段代码我只是不正确。如果在客户交付选项卡中更新,我需要更新客户位置中的自定义字段 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.
}

【问题讨论】:

    标签: events customization acumatica


    【解决方案1】:

    你有

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

    不应该这样吗

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

    ?

    【讨论】:

    • 这只是其中的一小部分...我在早期版本中对其进行了更正。我仍然收到 LocationExt 不存在的错误。位置交付 = locationObj.Select(row.LocationBAccountID); var locationExt = PXCache.GetExtension(delivery); // Base.SetValueExt(locationExt, "UsrCustomerShipAccount");
    • 超时。那只是其中的一小部分……我在早期版本中对其进行了更正。我仍然收到 LocationExt 不存在的错误。位置交付 = locationObj.Select(row.LocationBAccountID); var locationExt = PXCache.GetExtension(delivery);
    • 如果您得到 Location=null 并检查 locationExt =null,您应该检查您的代码。我会切换到 Location locationExt = PXSelect>>.Select(this,row.LocationBAccountID)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-08-24
    • 2019-01-31
    • 2018-02-25
    相关资源
    最近更新 更多