microsoft / ALAppExtensions

Repository for collaboration on Microsoft AL application add-on and localization extensions for Microsoft Dynamics 365 Business Central.
MIT License
763 stars 608 forks source link

[Extensibility Enhancement] Report Selection OnFindReportSelection and OnBeforeGetCustomReportSelection provide RecordVariant as parameter #25892

Open lv-janpieter opened 6 months ago

lv-janpieter commented 6 months ago

Describe the request

We have many cases where we would like to limit the choice of report selection based on information on the sourcerecord RecordVariant. However the events OnFindReportSelection and OnBeforeGetCustomReportSelection do not provide the RecordVariant. We did manage to work arround this by subscribing to a lot of other events and store the source record in a single instance codeunit, but this method is not safe and we keep running into scenario's that do not work as intended and it needs patch after patch and it is getting really messy. So we would like a solution that does not involve instable single instance variables.

Because it is quite a big change, for your convienience, I attached to this topic a draft proposal of the changes to be made based on BC23. You can view it with your favorite side-by-side comparison tool. Table Report Selections BC23_Adjusted.txt Table Report Selections BC23.txt

Primarely we would like the RecordVariant to be proviced in the events:

To achieve this we need a lot more changes cascading all the way back through the call stack until we hit a function that actual still provides the source record.

Not all public functions however do provide this source record, in these cases it is ok to provide an empty recordvariant. In our integrations we can skip these cases. You may want to conside to also obsolete the original functions because I think there always must be a source record involved. But we need them for now so there will be no breaking change.

These function also needs a parameter RecordVariant: Variant. These function needs to pass this variable through.

Additional context

Our integrations with the report selectons are unstable because some events do not provide the source record. Internal work item: AB#499179

azure-boards[bot] commented 6 months ago

✅ Successfully linked to Azure Boards work item(s):