Introduction
Dynamics 365 Finance and Operations (D365FO) traditionally uses the Gregorian calendar for date selections. If your organization requires the Persian calendar, you can customize the default date picker form, SysDateLookUp, to accommodate this need. This blog provides a detailed guide on how to achieve this, including the creation of necessary classes and methods for date conversion.
Step-by-Step Guide
1. Duplicate the SysDateLookUp Form
To begin, you need to create a copy of the existing SysDateLookUp form, which will be customized to use the Persian calendar.
- Action: In the Application Object Tree (AOT), locate the SysDateLookUp form, right-click it, and select "Duplicate."
- Name the new form:
PersianDateLookup
2. Configure the Persian Calendar
Open the Form:
- Navigate to the AOT, find the duplicated
PersianDateLookup
form, and open it.
- Navigate to the AOT, find the duplicated
Modify the Init Method:
- Open the
init
method of the PersianDateLookup form and set the calendar type to Persian. - Use a utility or method to handle Persian calendar settings.
3. Convert Selected Dates to Persian
Modify the CloseSelect Method:
- Open the
CloseSelect
method in the PersianDateLookup form. - Implement logic to convert the Gregorian date returned by the picker to a Persian date.
Update Date Control Handling:
- Implement methods to initialize and handle date control changes.
4. Create and Configure New String EDT
Create a New String EDT:
- Navigate to the EDT (Extended Data Type) node in AOT and create a new String EDT named
PersianDate
.
4. Create and Configure New String EDT
Create a New String EDT:
- Navigate to the EDT (Extended Data Type) node in AOT and create a new String EDT named
PersianDate
.
EDT Name: PersianDate
- Navigate to the EDT (Extended Data Type) node in AOT and create a new String EDT named
Set Lookup Reference:
- Configure the lookup reference of the
PersianDate
EDT to point to thePersianDateLookup
form.
- Configure the lookup reference of the
Adjust Properties:
- Set the properties of the
PersianDate
EDT to ensure it visually mimics the standard datetime picker style.
- Set the properties of the
5. Update Table Fields and Form Controls
Replace Existing EDTs:
- Replace any existing DateTime EDT references in your tables with the new
PersianDate
EDT.
- Replace any existing DateTime EDT references in your tables with the new
Update Form Controls:
- On forms where dates are displayed or selected, update the controls to use the
PersianDate
EDT. This ensures that all date-related interactions utilize the Persian calendar.
- On forms where dates are displayed or selected, update the controls to use the
Additional Methods for Date Conversion
To support Persian calendar functionalities, you can add the following methods to the Global_Extension
class:
Conclusion
Customizing the SysDateLookUp form to use the Persian calendar involves several steps: duplicating and modifying the form, creating and configuring a new String EDT, and updating your system to use Persian dates. Additionally, adding methods for date conversion in the Global_Extension
class ensures seamless handling of dates between Gregorian and Persian calendars. By following these steps, you can provide a tailored date handling experience in D365FO that meets your organization's needs.
Comments
Post a Comment