Solved

How do I go about setting the default Period From on the Account Details screen (GL404000)?

  • 3 January 2023
  • 2 replies
  • 270 views

Userlevel 5
Badge +1

I have been asked if it’s possible to set the From Period to default to 01-2022 instead of 01-2023.  I’m not sure how to go about doing this.  I presume I need to somehow get the correct Period ID from the string 01-2022 or date 01/01/2022 and set it in the FieldDefaulting Event Handler but I’m not sure how to go about getting the PeriodID to set.

Thanks for any advice,

Phil

icon

Best answer by Yuriy Zaletskyy 22 January 2023, 09:33

View original

2 replies

Userlevel 5
Badge +3

One way to do this is by using the FieldDefaulting event handler for the From Period field.

Here are the steps you can follow to set the default value for the From Period field:

  1. Create a custom field defaulting event for the From Period field in your customization project.
  2. In the event handler, use the PXSelector attribute to query the FinancialPeriod DAC for the period with the start date of 01/01/2022.
  3. Use the PXCache.SetDefault() method to set the value of the From Period field to the Period ID of the period you retrieved in step 2.

Here is an example of what the code for the custom field defaulting event might look like:

[PXDBString(6, IsKey = true, InputMask = "yyyyMM")]
[PXDefault(typeof(Search<FinPeriod.finPeriodID, Where<FinPeriod.startDate, Equal<Required<FinPeriod.startDate>>>>))]
protected virtual void FinPeriod_FromPeriodID_CacheAttached(PXCache sender)
{
}

In this case, the default value for the From Period field will be set to the finPeriodID for the FinPeriod with the start date 01/01/2022.

Note that you will also need to make sure that the Financial Periods for 2022 have already been created in the system before this customization is applied.

Userlevel 5
Badge +1

@Yuriy Zaletskyy Thanks very much for taking the time to give such a detailed answer.  I really appreciate it.

 

Phil

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved