Skip to main content
Solved

how to initialize the field checkbox by default true?

  • Mar 3, 2021 10:04 PM UTC
  • 2 replies
  • 1452 views
  • Translate All

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

2 replies

Hughes Beausejour
Acumatica Employee
Forum|alt.badge.img+2
  • Acumatica Developer Support Team
  • Answer
  • Mar 3, 2021 10:07 PM UTC

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

Translate

  • Author
  • Freshman I
  • Mar 4, 2021 8:19 AM UTC

Solved. thank you very much.

Translate