Skip to main content
Question

How to populate a selector with open financial periods and default to the current financial period?

  • February 3, 2024
  • 0 replies
  • 135 views

Hello, Community. It took me some time to figure this out, but here is the solution:

 

using PX.Objects.GL.FinPeriods.TableDefinition;

public abstract class consumptionDateFilter : PX.Data.BQL.BqlString.Field<consumptionDateFilter> { }
[OpenPeriod]
[PXDefault(typeof(Search<FinPeriod.finPeriodID,
                    Where<FinPeriod.startDate, LessEqual<AccessInfo.businessDate.FromCurrent>,
                    And<FinPeriod.endDate, Greater<AccessInfo.businessDate.FromCurrent>>>>),
                    PersistingCheck = PXPersistingCheck.NullOrBlank)]

 [PXUIField(DisplayName = "Períod ID")]
 public virtual string ConsumptionDateFilter { get; set; }