我正在尝试为CS设置默认客户,但我收到错误" RevisionID'不能空着#34;请协助
protected void SOOrder_CustomerID_FieldUpdating(PXCache cache, PXFieldUpdatingEventArgs e)
{
SOOrder row = (SOOrder)e.Row;
if(row == null) return;
if (row.OrderType == "CS" || row.OrderType == "SS")
{
row.CustomerID = 7211;
}
else
{
row.CustomerID = null;
}
}
答案 0 :(得分:1)
在您的特定情况下,必须使用 FieldDefaulting 事件而不是 FieldUpdating 来生成“客户ID”字段的默认值。根据{{3}},在 FieldDefaulting 事件处理程序中,新值必须分配给 PXFieldDefaultingEventArgs 的 NewValue 属性,并且永远不会直接分配给DAC领域:
protected void SOOrder_CustomerID_FieldDefaulting(PXCache cache, PXFieldDefaultingEventArgs e)
{
SOOrder row = (SOOrder)e.Row;
if(row == null) return;
if (row.OrderType == "CS" || row.OrderType == "SS")
{
e.NewValue = 7211;
}
}