Skip to main content
Solved

how to initialize the field checkbox by default true?


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

View original
Did this topic help you find an answer to your question?

2 replies

Hughes Beausejour
Acumatica Employee
Forum|alt.badge.img+2
  • Acumatica Developer Support Team
  • 91 replies
  • 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
  • 2 replies
  • March 4, 2021

Solved. thank you very much.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings