microsoft / ALAppExtensions

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

Codeunit 9755 "Media Resources Mgt.": Make MediaResourcesMgt.ReadTextFromMediaResource('ApplicationCountry') available for Target Cloud #26521

Closed DanielGoehler closed 2 months ago

DanielGoehler commented 6 months ago

Describe the request

Please remove Scope('OnPrem') from `ReadTextFromMediaResource' including all related tables such as "Media Resources".

    //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    //-[Scope('OnPrem')]
    //---------------------------------------------------------
    procedure ReadTextFromMediaResource(MediaResourcesCode: Code[50]) MediaText: Text
    var
        MediaResources: Record "Media Resources";
        TextInStream: InStream;
    begin
        if not MediaResources.Get(MediaResourcesCode) then
            exit;

        MediaResources.CalcFields(Blob);
        MediaResources.Blob.CreateInStream(TextInStream, TEXTENCODING::UTF8);
        TextInStream.Read(MediaText);
    end;

Additional context

To implement country-specific logic in your Business Central application for cloud and onprem deployments, it is essential to access MediaResourcesMgt.ReadTextFromMediaResource('ApplicationCountry') in these databases. Currently, this function is only available for the OnPrem target, which requires customers to pay the "implemented code is not cloud optimized" fee.

Examples of Country-Specific Logic

  1. Germany and Austria:

    • Additional tables for Issued Delivery Reminder Header to notify vendors about undelivered goods.
  2. Switzerland:

    • Additional payment logic called QR Bill, where payment details, including amount and bank information, are embedded in a QR barcode for supplier invoice payments.

Use Case

Our Document Management System connector requires:

To facilitate these requirements, we propose moving the country-specific code to a manual subscriber codeunit. This codeunit should bind only when the ApplicationCountry target matches the respective country code. This approach ensures that the country-specific logic is modular, maintainable, and deployable in both cloud and on-premises environments without incurring additional fees.

Summary

We request the following:

This enhancement will ensure that our application can efficiently handle country-specific requirements in both cloud and on-premises deployments. Internal work item: AB#538772

Groenbech96 commented 2 months ago

You need to be more specific in "All Related Tables". Media Resource is a platform system table, cannot be changed.

DanielGoehler commented 2 months ago

@Groenbech96 What do you mean? I requested the database country version. The only way I see to obtain it is through MediaResourcesMgt.ReadTextFromMediaResource('ApplicationCountry'), which cannot be used in SaaS.

Groenbech96 commented 2 months ago

You said in the first line Please remove Scope('OnPrem') from `ReadTextFromMediaResource' including all related tables such as "Media Resources".

DanielGoehler commented 2 months ago

@Groenbech96 Ok, as an alternative, is there a way to provide me that information and wrap MediaResourcesMgt.ReadTextFromMediaResource('ApplicationCountry')?

Groenbech96 commented 2 months ago

I think we are not understanding each other. Let me reface my question.

Do you only need ReadTextFromMediaResource to be non OnPrem? Then i will go a head and talk with the team if we can do that.

DanielGoehler commented 2 months ago

@Groenbech96 I understand that it wasn't possible to remove the OnPrem scope from ReadTextFromMediaResource() due to potential unintended use cases. I need the database country version (e.g., W1, BE, DE, DK, etc.) from MediaResourcesMgt.ReadTextFromMediaResource('ApplicationCountry') for both OnPrem and SaaS environments. The specific implementation details are not crucial; the reason for my request is outlined above. If you need any additional information, please let me know.

JesperSchulz commented 2 months ago

Thanks for reporting this. We agree, and we’ll publish a fix asap, either in an update for the current version or in the next major release. Please do not reply to this, as we do not monitor closed issues. If you have follow-up questions or requests, please create a new issue where you reference this one.

Build ID: 24667.