Can I change the business date through BLC code? I know it's in the AccessInfo DAC (AccessInfo.businessDate).
Thanks...
The static PXContext
has a public static method called SetBusinessDate
, You can use that method to change the Business Date.
public static void SetBusinessDate(DateTime? date)
{
PXContext.PXIdentity.BusinessDate = date;
}
You can simply call PXContext.SetBusinessDate method and force a page refresh after that, otherwise the UI will still show the old business date.
var YOUR_NEW_BUSINESS_DATE = new DateTime(2022,01,01);
PXContext.SetBusinessDate(YOUR_NEW_BUSINESS_DATE);
throw new PXRefreshException();