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 Not Appearing in Office Integration (Excel Add-in)

(0) ShareShare
ReportReport
Posted on by 46

Hi everyone,

I’ve created a custom data entity with the header data source as LedgerJournalTable, and added it as a template so that it can be opened in Excel using the Office Add-in.

According to the Microsoft Learn documentation, when the header data source of the entity matches the main data source of the form, the entity should automatically appear in the Office Integration section of the form.

However, in my case, it’s not showing up under the Office integration options.

Has anyone faced a similar issue or know what could be missing in my setup?

 
using Microsoft.Dynamics.Platform.Integration.Office;
/// <summary>
/// The <c>ExpenseJournalExcelTemplate</c> is the supporting class for the expense journal excel template.
/// </summary>
public class ExpenseJournalExcelTemplateCopy extends DocuTemplateRegistrationBase implements LedgerIJournalExcelTemplate
{
    private const DocuTemplateName ExcelTemplateName    = resourceStr(ProjectExpenseJournalCopy);
    private const DataEntityName LineEntityName         = tableStr(ExpenseJournalLineEntityCopy);
    private const FieldName LineEntityJournalNum        = fieldStr(ExpenseJournalLineEntityCopy, JournalBatchNumber);
    private const FieldName LineEntityDataAreaId        = fieldStr(ExpenseJournalLineEntityCopy, dataAreaId);
    private const DataEntityName HeaderEntityName       = tableStr(ExpenseJournalHeaderEntityCopy);
    private const FieldName HeaderEntityJournalNum      = fieldStr(ExpenseJournalHeaderEntityCopy, JournalBatchNumber);
    private const FieldName HeaderEntityDataAreaId      = fieldStr(ExpenseJournalHeaderEntityCopy, 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 copy for project"),
                literalStr("Journal lines copy for project"),
                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(ExpenseJournalLineEntityCopy, OffsetAccountType), LedgerJournalACType::Ledger),
            _lineFilterBuilder.areEqual(fieldStr(ExpenseJournalLineEntityCopy, OffsetAccountType), LedgerJournalACType::Vend));
        Microsoft.Dynamics.Platform.Integration.Office.FilterCollectionNode custBank = _lineFilterBuilder.or(
            _lineFilterBuilder.areEqual(fieldStr(ExpenseJournalLineEntityCopy, OffsetAccountType), LedgerJournalACType::Cust),
            _lineFilterBuilder.areEqual(fieldStr(ExpenseJournalLineEntityCopy, 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(ExpenseJournalLineEntityCopy, AccountType), LedgerJournalACType::Project),
            offsetFilters);
        return _lineFilterBuilder.and(_lineFilter, ledgerFilter);
    }
}
Categories:
I have the same question (0)
  • Adis Profile Picture
    5,821 Super User 2025 Season 2 on at
    Custom Data Entity Not Appearing in Office Integration (Excel Add-in)
    Hey,
     
    As far as I understood, you added the template here.
    Could you show us the root data entity and also where you expect it to appear, in which form?
    I guess when you uploaded it you have left the specific company, region or language empty, or?
     
     

    Kind regards, Adis

     

    If this helped, please mark it as "Verified" for others facing the same issue

    Keep in mind that it is possible to mark more than one answer as verified

     
  • Suggested answer
    André Arnaud de Calavon Profile Picture
    300,071 Super User 2025 Season 2 on at
    Custom Data Entity Not Appearing in Office Integration (Excel Add-in)
    Hi,
     
    For journals, the new templates are not showing up by default. Only when you overwrite an existing template. If you need to have additional options to choose from, a customization is required. 
     
    The automatic addition is valid for about 98% of the forms. Journals are handled in a different way with X++ coding.

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…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

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

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 580 Most Valuable Professional

#3
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 554

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans