在图表级别上建立字段必填

时间:2018-03-19 19:46:47

标签: attributes field acumatica dac

这里是Acumatica的新人。我已对我们的系统进行了少量自定义,现在我正在开始添加自定义数据字段。

我的目标是将Acumatica的硬件出货信息同步到我们的传统(过时和专有)硬件管理系统,因为我们需要继续使用该系统进行保修计算。我计划最终把它建成Acumatica。

我目前的问题是我需要一种方法将Customer Locations与我们旧系统中的客户位置相关联。添加字段DCL_ID很容易完成To Add a Custom Data Field文档。我通过设置

来设置列
[PXDefault]
[PXUIField(DisplayName="DCL Account ID", Required = true)]

到数据访问类as outlined here的属性部分。然后我使用布局编辑器将该字段添加到我的表单中。

此时一切似乎都很顺利。该字段在UI中显示星号,并验证是否提供了值。然后我意识到客户位置不是唯一使用CR.Location的地方 - Account Locations也使用它。进行一些挖掘我发现帐户位置可以包含比客户位置更多的帐户类型。我只需要客户位置需要此属性。因此,我选择使用To Make a Field Mandatory on the Graph Level

这是我的CustomerLocationMaint代码:

using System;
using PX.Data;
using PX.Objects.CR;
using System.Collections.Generic;
using PX.Objects;
using PX.Objects.AR;

namespace PX.Objects.AR
{
  public class CustomerLocationMaint_Extension : PXGraphExtension<CustomerLocationMaint>
  {
    #region Event Handlers

    [PXDefault]
    [PXCustomizeBaseAttribute(typeof(PXUIFieldAttribute), "Required", true)]
    protected virtual void SelectedCustomerLocation_UsrDCL_ID_CacheAttached(PXCache cache)
    {

    }

    #endregion
  }
}

保存并发布自定义后,该字段不能作为必填字段,就像我在DAC级别定义要求时那样。

enter image description here

那么,我做错了什么?我多次阅读并重新阅读文档,但找不到我的错误。

设置: CR.Location

Layout Editor: AR303020

CustomerLocationMaint

1 个答案:

答案 0 :(得分:2)

我的想法是字段名称中的下划线,导致缓存附加到未正确注册图级别属性更改。使用不带下划线的字段名称是表和列的首选命名约定。

Acumatica文档提到这应该避免,如下所示: Database Design Guidelines

表和列命名约定下找到:

  

不要在表名或列名中使用下划线符号(_),因为   它是Acumatica Framework中的保留符号。例如,   CompanyType是有效的列名,而Company_Type无效。