【问题标题】:Acumatica - Creating Custom Usr Field on Purchase Orders for Weight TotalAcumatica - 在总重量的采购订单上创建自定义用户字段
【发布时间】:2018-04-03 16:06:16
【问题描述】:

我正在尝试通过自定义浏览器将新字段添加到采购订单屏幕 (PO301000)。我通过“新建字段”按钮创建了该字段,并稍微编辑了“数据访问”以为该字段提供默认参数。这是数据访问中的代码:

[PXDBDecimal]
[PXDefault(TypeCode.Decimal, "0.0")]
[PXUIField(DisplayName="Weight Total")]

此字段将用于计算采购订单的总重量,我希望将其存储在数据库中。 发布时出现此错误:

An error while publishing the database item POOrder
 with the message:
Nullable object must have a value.

我尝试将PXDBDecimal 更改为PXDBQuantity。这必须通过自定义浏览器而不是数据库本身来完成,因为该项目将在我无法访问数据库的 SaaS 托管站点上进行。我也尝试过仅通过 DAC 创建字段,但在尝试打开页面时收到此错误:

    Invalid column name 'UsrWeightTotal'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Data.SqlClient.SqlException: Invalid column name 'UsrWeightTotal'.

【问题讨论】:

  • 您需要项目中的表条目。如果您查看项目 xml,您有吗?同样对于 PXDefault,您是说所有记录(包括以前的订单)都需要一个值。通过更改对该字段的 PXDefault 的持久检查来允许以前的记录为空值会很好
  • 我在项目 XML 中添加了 PersistingCheck=PXPersistingCheck.Nothing 并且表是 POOrder,我仍然遇到同样的问题。
  • 在发布过程中您在哪里得到错误?验证期间?
  • 不,在更新数据库的那一刻之后。
  • Usr 字段设置是否在 SQL 中可以为空?否则它需要一个 sql 默认值为零

标签: customization acumatica


【解决方案1】:

在查看定制中 POOrder 表条目的项目 xml 时,我发现十进制列类型需要一些额外/缺失的属性。

有一个 MaxLength 属性,但没有 DecimalLength 属性。我将其与添加一个十进制类型的新字段进行了比较,并查看了项目 xml 以得出以下结论:

<Table TableName="POOrder"> 
<Column TableName="POOrder" ColumnName="UsrWeightTotal" ColumnType="decimal" AllowNull="True" DecimalPrecision="6" DecimalLength="19" IsNewColumn="True" IsUnicode="True" /> 
</Table>

我敢打赌,错误是抱怨缺少 DecimalLength 值(结果为 null,但发布过程需要)。

【讨论】:

猜你喜欢
  • 2015-09-13
  • 1970-01-01
  • 2017-07-31
  • 2014-11-16
  • 1970-01-01
  • 2020-11-24
  • 1970-01-01
  • 2019-06-16
  • 1970-01-01
相关资源
最近更新 更多