Skip to content

Include extension fields in Invoke-D365GenerateReportDataEntity (#649)#910

Open
pavankadabala-png wants to merge 1 commit into
d365collaborative:masterfrom
pavankadabala-png:fix/649-report-data-entity-extension-fields
Open

Include extension fields in Invoke-D365GenerateReportDataEntity (#649)#910
pavankadabala-png wants to merge 1 commit into
d365collaborative:masterfrom
pavankadabala-png:fix/649-report-data-entity-extension-fields

Conversation

@pavankadabala-png

Copy link
Copy Markdown
Contributor

What this does

Invoke-D365GenerateReportDataEntity reflects over data entities with the metadata disk provider and lists their fields, but it currently omits any fields added to an entity through extensions.

This switches the entity read from DataEntityViews.Read(...) to ExtensionMethods.ReadDataEntityViewWithExtensions(...), so the generated report includes extension fields as well.

Why

Closes #649. Full credit to @FH-Inway, who investigated the (undocumented) metadata API, identified the exact fix, and confirmed a working version in the issue thread.

Change

In invoke-d365generatereportdataentity.ps1:

# before
$element = $metadataProvider.DataEntityViews.Read($elementName)
# after
$element = [Microsoft.Dynamics.AX.Metadata.Storage.Extension.ExtensionMethods]::ReadDataEntityViewWithExtensions($metadataProvider, $elementName, $null, $null)

ExtensionMethods lives in the same Microsoft.Dynamics.AX.Metadata.Storage assembly that is already loaded via Import-GenerateReportAssemblies (and used for MetadataProviderFactory), so no new dependency is introduced. The disk provider is still used, so the cmdlet continues to run against uncompiled sources.

Follow-up

As @FH-Inway noted, Invoke-D365GenerateReportDataEntityField (via the internal Get-AXDataEntities) likely needs the same treatment. Happy to address that in a separate, focused PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

invoke-d365generatereportdataentity lacks extended fields

1 participant