web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested answer

Custom Data Entity Excel-Addin Template's Root Entity Error

(0) ShareShare
ReportReport
Posted on by 34

I created a custom entity as a replica of the Project Expense Journal line entity for excel addin , replicating all the related processes. I also created a template Excel class, for generating excel template in docu template example:

class Tech_GLJournalExcelTemplate extends DocuTemplateRegistrationBase implements LedgerIJournalExcelTemplate
 

After building the project, the template was generated successfully. However, the root entity that gets mapped is still the standard Expense Journal Entity, even though I specified my custom entity in the class.

What could be causing this issue, and how can it be resolved?

Categories:
I have the same question (0)
  • Martin Dráb Profile Picture
    236,116 Most Valuable Professional on at
    Custom Data Entity Excel-Addin Template's Root Entity Error
    I don't understand what you mean. Could you please tell us what is the root entity of template in TechGLJournalLineEntityTemplate resource? You just said it was uploaded correctly but not what you have inside.
  • AP-17101228-0 Profile Picture
    34 on at
    Custom Data Entity Excel-Addin Template's Root Entity Error
    @Martin Dráb  template file got uploaded correctly but the root entity that i mapped got varies ,it got mapped to the standard Expense Journal line entity..
  • Martin Dráb Profile Picture
    236,116 Most Valuable Professional on at
    Custom Data Entity Excel-Addin Template's Root Entity Error
    Okay, so you're using a template from the AOT resource called TechGLJournalLineEntityTemplate. There you seem to be using a different entity than intended. If it's the case, fix the template, update the AOT resource and try it again.
  • AP-17101228-0 Profile Picture
    34 on at
    Custom Data Entity Excel-Addin Template's Root Entity Error
    @Martin Dráb this is the template that i've user
     
    using Microsoft.Dynamics.Platform.Integration.Office;
    public class Tech_GLJournalExcelTemplate extends DocuTemplateRegistrationBase  implements LedgerIJournalExcelTemplate
    {
        private const DocuTemplateName ExcelTemplateName    = resourceStr(TechGLJournalLineEntityTemplate);
        private const DataEntityName LineEntityName         = tableStr(Tech_GLLinesEntity);
        private const FieldName LineEntityJournalNum        = fieldStr(Tech_GLLinesEntity, JournalBatchNumber);
        private const FieldName LineEntityDataAreaId        = fieldStr(Tech_GLLinesEntity, dataAreaId);
        private const DataEntityName HeaderEntityName       = tableStr(Tech_GLHeaderEntity);
        private const FieldName HeaderEntityJournalNum      = fieldStr(Tech_GLHeaderEntity, JournalBatchNumber);
        private const FieldName HeaderEntityDataAreaId      = fieldStr(Tech_GLHeaderEntity, dataAreaId);
        public boolean isJournalTypeSupported(LedgerJournalType _ledgerJournalType)
        {
            return _ledgerJournalType == LedgerJournalType::Cost;
        }
        public void applyCustomTrimming(Excel.IWorkbookManager _templateManager, Excel.WorkbookSettingsManager _settingsManager, LedgerJournalTable _ledgerJournalTable)
        {
        }
        public DocuTemplateName documentTemplateName()
        {
            return ExcelTemplateName;
        }
        public Set supportedAccountTypes()
        {
            Set accountTypeSet = new Set(Types::Integer);
            accountTypeSet.add(LedgerJournalACType::Project);
            return accountTypeSet;
        }
        public Set supportedOffsetAccountTypes()
        {
            Set offsetAccountTypeSet = new Set(Types::Integer);
            offsetAccountTypeSet.add(LedgerJournalACType::Ledger);
            offsetAccountTypeSet.add(LedgerJournalACType::Cust);
            offsetAccountTypeSet.add(LedgerJournalACType::Vend);
            offsetAccountTypeSet.add(LedgerJournalACType::Bank);
            return offsetAccountTypeSet;
        }
        public boolean validateJournalForTemplate(LedgerJournalTable _ledgerJournalTable)
        {
            return LedgerJournalExcelTemplate::validateJournalForTemplate(_ledgerJournalTable, this);
        }
        public void registerTemplates()
        {
            this.addTemplate(
                    OfficeAppApplicationType::Excel,
                    ExcelTemplateName,
                    ExcelTemplateName,
                    literalStr("Journal lines for general journal excel template "),
                    literalStr("Journal lines for general journal"),
                    NoYes::No,
                    NoYes::No);
        }
        public DataEntityName headerEntityName()
        {
            return HeaderEntityName;
        }
        public DataEntityName lineEntityName()
        {
            return LineEntityName;
        }
        public FieldName headerJournalBatchNumberFieldName()
        {
            return HeaderEntityJournalNum;
        }
        public FieldName headerDataAreaFieldName()
        {
            return HeaderEntityDataAreaId;
        }
        public FieldName lineJournalBatchNumberFieldName()
        {
            return LineEntityJournalNum;
        }
        public FieldName lineDataAreaFieldName()
        {
            return LineEntityDataAreaId;
        }
        public Microsoft.Dynamics.Platform.Integration.Office.FilterCollectionNode appendHeaderEntityFilters(Microsoft.Dynamics.Platform.Integration.Office.FilterCollectionNode _headerFilter, ExportToExcelFilterTreeBuilder _headerFilterBuilder)
        {
            return _headerFilter;
        }
        public Microsoft.Dynamics.Platform.Integration.Office.FilterCollectionNode appendLineEntityFilters(Microsoft.Dynamics.Platform.Integration.Office.FilterCollectionNode _lineFilter, ExportToExcelFilterTreeBuilder _lineFilterBuilder)
        {
            Microsoft.Dynamics.Platform.Integration.Office.FilterCollectionNode ledgerVend = _lineFilterBuilder.or(
                _lineFilterBuilder.areEqual(fieldStr(Tech_GLLinesEntity, OffsetAccountType), LedgerJournalACType::Ledger),
                _lineFilterBuilder.areEqual(fieldStr(Tech_GLLinesEntity, OffsetAccountType), LedgerJournalACType::Vend));
            Microsoft.Dynamics.Platform.Integration.Office.FilterCollectionNode custBank = _lineFilterBuilder.or(
                _lineFilterBuilder.areEqual(fieldStr(Tech_GLLinesEntity, OffsetAccountType), LedgerJournalACType::Cust),
                _lineFilterBuilder.areEqual(fieldStr(Tech_GLLinesEntity, OffsetAccountType), LedgerJournalACType::Bank));
            Microsoft.Dynamics.Platform.Integration.Office.FilterCollectionNode offsetFilters = _lineFilterBuilder.or(ledgerVend,custBank);
            Microsoft.Dynamics.Platform.Integration.Office.FilterCollectionNode ledgerFilter = _lineFilterBuilder.and(
                _lineFilterBuilder.areEqual(fieldStr(Tech_GLLinesEntity, AccountType), LedgerJournalACType::Project),
                offsetFilters);
            return _lineFilterBuilder.and(_lineFilter, ledgerFilter);
        }
    }
  • Suggested answer
    Martin Dráb Profile Picture
    236,116 Most Valuable Professional on at
    Custom Data Entity Excel-Addin Template's Root Entity Error
    You said you specified your custom entity in a class, but what template do you refer to in Tech_GLJournalExcelTemplate.registerTemplates()
    You didn't mention creating a new template, adding to an AOT resource and referring to it in registerTemplates, so you probably keep referring to a standard template that know nothing about your entity. The third parameter of addTemplate() is the AOT resource name containing the template.]
     
    I'm assuming this is about F&O, therefore I'm going to remove "Microsoft Dynamics AX" category from this thread.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 1,072

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 831 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 829 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans