在图级别上强制执行字段 [英] Make a Field Mandatory on the Graph Level

查看:133
本文介绍了在图级别上强制执行字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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



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



我当前的问题是我需要一种关联



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



设置:





解决方案

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



Acumatica文档中提到应避免这种情况,如以下所列:
数据库设计准则



表和列命名约定


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



Newbie to Acumatica here. I've performed a small amount of customization to our system, and am now diving into adding custom data fields.

My goal is to synchronize hardware shipment information from Acumatica into our legacy (outdated and proprietary) hardware management system, as we will need to continue using this system for the time being for warranty calculations. I plan to eventually build this into Acumatica.

My current issue is that I need a method of associating Customer Locations to the customer locations in our legacy system. Adding the field DCL_ID was easy enough to accomplish following the To Add a Custom Data Field documentation. I made the column be required by setting

[PXDefault]
[PXUIField(DisplayName="DCL Account ID", Required = true)]

to the attributes section of the Data Access class as outlined here. I then added the field to my form using the Layout Editor.

At this point all seemed well. The field shows an asterisk in the UI and also validates that a value is provided. Then I realized that Customer Locations is not the only place that uses CR.Location -- it is also used by Account Locations. Doing some digging I've found that Account Locations can include many more account types than Customer Locations. I only need this attribute to be required for Customer Locations. Thus, I have opted to use the To Make a Field Mandatory on the Graph Level.

Here is my CustomerLocationMaint code:

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
  }
}

After I save and publish the customization, the field does not function as a required field, as it did when I defined the requirements at the DAC level.

So, what have I done wrong? I've read and re-read the documentation multiple times, but cannot find my mistake.

Setup:

解决方案

My thought is the underscore in the field name causing the cache attached to not properly register the graph level attribute change. Using a field name without the underscore is the preferred naming convention for tables and columns.

The Acumatica documentation mentions this should be avoided as listed here: Database Design Guidelines

Found under Table and Column Naming Conventions:

Do not use the underscore symbol (_) in table or column names, because it is a reserved symbol in Acumatica Framework. For example, CompanyType is a valid column name, while Company_Type is invalid.

这篇关于在图级别上强制执行字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆