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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

Customizing InventJournalTransfer form Open in Office menu with specific template and filters

(1) ShareShare
ReportReport
Posted on by 245

Hi Everyone,

I customized my InventJournalTransfer form to display a specific template I loaded to import inventory transfer lines(because it does not have the same root data source), using the steps on the page "Customize Open in Office menu" (https://docs.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/office-integration/customize-open-office-menu?toc=/dynamics365/commerce/toc.json)

using Microsoft.Dynamics.Platform.Integration.Office;
public static class InventJournalTransferForm_Extension
{
    [FormEventHandler(formStr(InventJournalTransfer), FormEventType::Initializing)]
    public static void ExportToExcel_DataEntityCustom_OnInitializing(xFormRun sender, FormEventArgs e)
    {
        FormRun formRun = sender as FormRun;
        if (formRun)
        {
            OfficeFormRunHelper officeHelper = formRun.officeHelper();
            if (officeHelper)
            {
                officeHelper.OfficeMenuInitializing  = eventhandler(InventJournalTransferForm_Extension::officeMenuInitializingHandler);
            }
        }
    }

    private static void officeMenuInitializingHandler(FormRun _formRun, OfficeMenuEventArgs _eventArgs)
    {
        OfficeMenuOptions _menuOptions = _eventArgs.menuOptions();

        //Create menu item
        OfficeTemplateExportMenuItem menuItem = OfficeTemplateExportMenuItem::construct(OfficeAppApplicationType::Excel, "MyInventoryTransferJournalTemplate", "MyInventoryTransferJournalTemplate");

        //Add the filters
        menuItem.getInitialTemplateFilters  = eventhandler(InventJournalTransferForm_Extension::getInitialTemplateFiltersHandler);
        menuItem.updateTemplateSettings  = eventhandler(InventJournalTransferForm_Extension::updateTemplateSettingsHandler);

        //Add the menu item
        _menuOptions.customMenuItems().addEnd(menuItem);
    }

}

The template was added correctly but it's displaying all the records instead of the one only related to the selected journal

I added the lines

menuItem.getInitialTemplateFilters = eventhandler(InventJournalTransferForm_Extension::getInitialTemplateFiltersHandler);
menuItem.updateTemplateSettings = eventhandler(InventJournalTransferForm_Extension::updateTemplateSettingsHandler);

to have the filter in place but now I get the following error: 

Severity Code Description Project File Line Suppression State
Error ClassDoesNotContainMethod: Class 'InventJournalTransferForm_Extension' does not contain a definition for method 'getInitialTemplateFiltersHandler' and no extension method 'getInitialTemplateFiltersHandler' accepting a first argument of type 'InventJournalTransferForm_Extension' is found on any extension class.

pastedimage1591991732100v1.png

What am I doing wrong ? On the document it specifies the delegates have to be subscribed before the menu item is added and that's what I did.

Thanks!

I have the same question (0)
  • Rahul Mohta Profile Picture
    21,032 on at

    why using custom code when Out of box option exists?

  • Slim Rouissi Profile Picture
    245 on at

    There is an entity for transfer orders out of the box not for transfer journal lines. That entity doesn't exist out of the box that's why it was created as a custom entity.

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar 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... 467 Super User 2025 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 420 Most Valuable Professional

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 241 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans