Өзгерту

Бөлісу құралы:


Electronic reporting framework API changes for Application update 10.0.17

This article describes how the application programming interfaces (APIs) of the Electronic reporting (ER) framework have been changed in Microsoft Dynamics 365 Finance version 10.0.17.

API to run a format mapping that provides a user action code to run action-dependent destinations

To generate an outbound document, you must run an ER format mapping. When the initial API of the ER framework is used to call an ER format mapping, all destinations that were configured for components of the format are always run. To review the sample code for a call of this type, see Add a report service class.

// Call ER to generate the report.
ERIFormatMappingRun formatMappingRun = ERObjectsFactory::createFormatMappingRunByFormatMappingId(formatMappingId, DefaultExportedFileName);
if(formatMappingRun.parmShowPromptDialog(true))
{
    formatMappingRun.withParameter(parameters);
    formatMappingRun.withFileDestination(_contract.getFileDestination());
    formatMappingRun.run();
}

In some cases, when an ER format mapping is called from a specific place in the X++ code, you must specify an action that the user performs by running an ER format, so that only action-dependent destinations are run instead of all the ER destinations that are configured for that format.

For example, you have an ER format that is based on Print management settings. When you call this ER format to preview a generated document, you expect that only the Screen destination will be run. However, when you call the same ER format to send a generated document as the attachment of an outbound email message, you expect that only the Email destination will be run.

To achieve these results, you must configure action-dependent ER destinations for the ER format. For more information, see Configure action-dependent ER destinations.

After you've completed the configuration, you can use the new API of the ER framework to call an ER format mapping that provides a user action code that runs only destinations that were configured for the provided action. The following example shows how you can change the previously mentioned sample code to use this new API to run an ER format that provides the View action.

// Call ER to generate the report.
ERIFormatMappingRun formatMappingRun = ERObjectsFactory::createFormatMappingRunByFormatMappingId(formatMappingId, DefaultExportedFileName);
if(formatMappingRun.parmShowPromptDialog(true))
{
    formatMappingRun.withParameter(parameters);
    formatMappingRun.withFileDestination(_contract.getFileDestination());

    var formatMappingRunWithAction = formatMappingRun as ERIFormatMappingRunWithDestinationAction;
    formatMappingRunWithAction.withDestinationAction(ERDestinationAction::View);
    formatMappingRun.run();
}

Important

To set up action-dependent destinations and force the ER framework to use the provided action code, you must first turn on the Configure specific ER destinations to be used for different PM actions feature in the Feature management workspace.

Additional resources

Electronic reporting (ER) overview

Electronic reporting (ER) destinations

Configure action-dependent ER destinations

Design a new ER solution to print a custom report