下面是我的代碼插入任何值輸入到我的UsrWLAmt字段到我的BudgetGrid代表的字段值的歷史。如何從另一個事件處理函數調用SetPropertyException?
我想提出一個警告,提示用戶在BudgetGrid歷史
protected void PMProject_UsrWLAmt_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e, PXFieldUpdated InvokeBaseHandler)
{
if(InvokeBaseHandler != null)
InvokeBaseHandler(cache, e);
var row = (PMProject)e.Row;
PMProject con = Base.Project.Current;
PX.Objects.PM.ProjectExt item = con.GetExtension<PX.Objects.PM.ProjectExt>();
if (item.UsrWLAmt > 0)
{
atcBudgetHis bud = new atcBudgetHis();
bud.CreatedDateTime = DateTime.Now;
bud.Value = item.UsrWLAmt;
BudgetGrid.Insert(bud);
// to attach the exception object to the field
BudgetGrid.View.Cache.RaiseExceptionHandling<atcBudgetHis.details>(
bud, " ",
new PXSetPropertyException(
"Please specifiy reason for budget change.",
PXErrorLevel.Warning));
}
}
輸入值詳談場我也試過BudgetGrid.Cahce.RaiseExceptionHandling
上面的代碼沒有按不會產生任何跟蹤錯誤。
編輯:
PXUIFieldAttribute.SetWarning<atcBudgetHis.details>(BudgetGrid.Cache, null, "Please specifiy reason for budget change.");
適用於所有的行,但
PXUIFieldAttribute.SetWarning<atcBudgetHis.details>(BudgetGrid.Cache, bud, "Please specifiy reason for budget change.");
不提出任何警告。
我可以在網格上方爲插入的音符創建另一個字段,但是有沒有辦法可以爲BudgetGird中的最後一行設置警告?
謝謝,但這一事件是由場上面坐着我PXGrid觸發。在SetWarning中使用行作爲第二個參數,因爲它在atcBudgetHis DAC中查找PMProject,所以不會發出警告和錯誤 – nickivey