在 Acumatica 中向数据访问 Class 添加字段
Adding fields to a Data Access Class in Acumatica
Acumatica 的新手,如有任何解释,我们将不胜感激。
我在“项目”屏幕上通过 DAC 添加了一个新字段。创建项目后,该字段将填充一个自定义项目 ID,该 ID 是一个整数。
代码如下:
namespace PX.Objects.PM
{
public class ProjectEntry_Extension : PXGraphExtension<ProjectEntry>
{
#region Event Handlers
protected void PMProject_RowInserted(PXCache cache, PXRowInsertedEventArgs e)
{
var row = (PMProject)e.Row;
row.UsrProjectID = 90000; //Custom Field with value
}
#endregion
}
}
但是在验证项目时 returns 错误:
\APP_CODE\Caches\ProjectEntry.cs does not contain a definition for 'UsrProjectID' and no extension
method 'UsrProjectID' accepting a first argument of type
'PX.Objects.PM.PMProject' could be found (are you missing a using
directive or an assembly reference?)
查看DAC后,发现DAC中添加了新的字段ContractExt.usrProjectID,请问如何添加到PXProject DAC或者从中调用字段代码事件?
您需要添加以下行才能访问 DAC 扩展
ContractExt myext = PXCache<Contract>.GetExtension<ContractExt>(row);
myext.UsrProjectID =...
Acumatica 的新手,如有任何解释,我们将不胜感激。
我在“项目”屏幕上通过 DAC 添加了一个新字段。创建项目后,该字段将填充一个自定义项目 ID,该 ID 是一个整数。
代码如下:
namespace PX.Objects.PM
{
public class ProjectEntry_Extension : PXGraphExtension<ProjectEntry>
{
#region Event Handlers
protected void PMProject_RowInserted(PXCache cache, PXRowInsertedEventArgs e)
{
var row = (PMProject)e.Row;
row.UsrProjectID = 90000; //Custom Field with value
}
#endregion
}
}
但是在验证项目时 returns 错误:
\APP_CODE\Caches\ProjectEntry.cs does not contain a definition for 'UsrProjectID' and no extension method 'UsrProjectID' accepting a first argument of type 'PX.Objects.PM.PMProject' could be found (are you missing a using directive or an assembly reference?)
查看DAC后,发现DAC中添加了新的字段ContractExt.usrProjectID,请问如何添加到PXProject DAC或者从中调用字段代码事件?
您需要添加以下行才能访问 DAC 扩展
ContractExt myext = PXCache<Contract>.GetExtension<ContractExt>(row);
myext.UsrProjectID =...