Skip to main content
Answer

how to initialize the field checkbox by default true?

  • March 3, 2021
  • 2 replies
  • 1378 views

I created a new field and I want to initialize by default true
Thanks for your help.

Best answer by Hughes Beausejour

For database bound field (PXDBBool) add PXDefault attribute to the DAC field declaration:
[PXDefault(true)]

For unbound field (PXBool) add PXUnboundDefault attribute instead:
[PXUnboundDefault(true)]

Example:
#region IsActive
public abstract class isActive : PX.Data.BQL.BqlBool.Field<isActive> { }
[PXDBBool()]
[PXDefault(true)]
[PXUIField(DisplayName = "Active")]
public virtual bool? IsActive { get; set; }
#endregion

2 replies

Hughes Beausejour
Acumatica Employee
Forum|alt.badge.img+2
  • Acumatica Developer Support Team
  • Answer
  • March 3, 2021

For database bound field (PXDBBool) add PXDefault attribute to the DAC field declaration:
[PXDefault(true)]

For unbound field (PXBool) add PXUnboundDefault attribute instead:
[PXUnboundDefault(true)]

Example:
#region IsActive
public abstract class isActive : PX.Data.BQL.BqlBool.Field<isActive> { }
[PXDBBool()]
[PXDefault(true)]
[PXUIField(DisplayName = "Active")]
public virtual bool? IsActive { get; set; }
#endregion


  • Author
  • Freshman I
  • March 4, 2021

Solved. thank you very much.