从任务中删除所需的所有者



创建与案例相关的新任务时,Acumatica 要求为该新任务分配所有者。 我需要做什么才能删除此要求? 我使用的是 18.210.0010。 谢谢。

所有者字段验证在RowPersisting事件中完成:

protected virtual void CRActivity_RowPersisting(PXCache sender, PXRowPersistingEventArgs e)
{
var row = e.Row as CRActivity;
if (row == null) return;
if ((e.Operation == PXDBOperation.Insert || e.Operation == PXDBOperation.Update) && row.OwnerID == null && row.WorkgroupID == null)
{
var displayName = PXUIFieldAttribute.GetDisplayName<CRActivity.ownerID>(Tasks.Cache);
var exception = new PXSetPropertyException(ErrorMessages.FieldIsEmpty, displayName);
if (Tasks.Cache.RaiseExceptionHandling<CRActivity.ownerID>(row, null, exception))
{
throw new PXRowPersistingException(typeof(CRActivity.ownerID).Name, null, ErrorMessages.FieldIsEmpty, displayName);
}
}
}

在这种情况下,鉴于这是事件中发生的唯一验证,您可以覆盖它,以便不调用原始事件:

public class CRTaskMaint_Extension : PXGraphExtension<CRTaskMaint>
{
protected void CRActivity_RowPersisting(PXCache cache, PXRowPersistingEventArgs e, PXRowPersisting InvokeBaseHandler)
{
//if(InvokeBaseHandler != null)
//  InvokeBaseHandler(cache, e); //Original Event handler is not invoked
}
}

请记住,此答案显示了如何从技术角度使"所有者"字段不是必需的。但是,Acumatica中此更改的进一步影响,即其他页面,报告等。 应考虑。

最新更新