Customize the standard excel template in D365FO
1. Create extensions for data entities: LedgerJournalLineEntity and LedgerJournalHeaderEntity.
2. Create extensions for the staging table: LedgerJournalLineCDSStaging, LedgerJournalHeaderCDSStaging
3. If you want to add dimensions to Excel templates
- In Microsoft Visual Studio, click Dynamics 365 > Addins > Add financial dimensions for Odata.
- Type the name of the Financial dimension in the Dimension Name column. This should be the exact name of the financial dimension. Select the Model that has your extensions. It should be above the AppSuite layer. Click Apply
- Add 2 extensions, DataEntity into the project: DimensionSetEntity.DimensionIntegration, DimensionCombinationEntity.DimensionIntegration.
- You must keep the extension name "DimensionIntegration" for the project to work properly.
4. Build and synchronize the project.
5. Open the standard Excel template, make modifications, and save it in a local path.
In our example, for the General Ledger Journal Excel template (LedgerJournalLineEntryTemplate).
- Go to Organization administration→ Setup→ Office integration→ Document templates, find the LedgerJournalLineEntryTemplate and download it
- In the Microsoft Dynamics Office Add-in, click the Design button
- Add/Remove some fields
- Click Update
- Save the modified version to a local path.
6. In Visual Studio, create a new project and add a Resource to the project
Point the Resource to the new saved Excel (step 5) in the local path.
7. Create a new class to extend DocuTemplateRegistrationBase class and implement LedgerIJournalExcelTemplate.
- Note: The DocuTemplateRegistrationBase class will look through all the child classes to populate the Document templates in D365O. The LedgerIJournalExcelTemplate is in the interface that has the framework.
- Copy all the logic from LedgerDailyJournalExcelTemplate class. This is the class for the standard General Ledger Journal Entry template. We just need to change the template name and label, as shown below:
- If you want the template to apply to all companies, you should use the method and template.
- If you want a template to apply to a specific region, you should use the method addTemplateForRegion.
8. Build and synchronize the project.
9. Reload system templates.
Comments
Post a Comment