日记帐分录屏幕上的必填字段错误

时间:2018-06-16 20:36:34

标签: acumatica

使用以下代码强制使用日记帐分录说明字段: 使用PX.Objects.CR; 使用PX.Data.EP;

using System;
using System.Collections;
using System.Collections.Generic;
using System.Web;
using System.Linq;
using PX.Api;
using PX.Data;
using PX.Common;
using PX.Objects.Common;
using PX.Objects.CS;
using PX.Objects.CM;
using PX.Objects.CA;
using PX.Objects.FA;
using PX.Objects.GL.JournalEntryState;
using PX.Objects.GL.JournalEntryState.PartiallyEditable;
using PX.Objects.GL.Overrides.PostGraph;
using PX.Objects.GL.Reclassification.UI;
using PX.Objects.PM;
using PX.Objects.TX;
using PX.Objects;
using PX.Objects.GL;

namespace PX.Objects.GL
{

  public class JournalEntry_Extension:PXGraphExtension<JournalEntry>
  {

    #region Event Handlers
    //start my code
    [PXDefault]
    [PXCustomizeBaseAttribute(typeof(PXUIFieldAttribute), "Required", true)]
    //end my code

    [PXUIField(DisplayName = "Description", Visibility = PXUIVisibility.Visible)]
    [PXDBString(255, IsUnicode = true)]
    protected virtual void Batch_Description_CacheAttached(PXCache cache)
    {

    }





    #endregion

  }


}

但是,我在浏览记录时收到错误消息,如下所示: enter image description here

错误: 错误:处理字段期间发生错误说明:无法转换类型&#39; System.Boolean&#39;输入&#39; System.String&#39; ..

不确定我做错了什么 感谢

1 个答案:

答案 0 :(得分:2)

您可以使用 PXUIField 属性将必需属性设置为 True 。请参阅下面的示例(请注意,必需属性上有无引号):

public class JournalEntry_Extension : PXGraphExtension<JournalEntry>
{

    #region Event Handlers
    [PXDefault]
    [PXUIField(DisplayName = "Description", Visibility = PXUIVisibility.Visible, Required = true)]
    [PXDBString(255, IsUnicode = true)]
    protected virtual void Batch_Description_CacheAttached(PXCache cache)
    {

    }
    #endregion
}