Table 6107 E-Documents Setup

E-Document Core, Microsoft.eServices.EDocument

src/Apps/W1/EDocument/App/src/Document/EDocumentsSetup.Table.al115 lines, Copyright (c) Microsoft Corporation. MIT

#if not CLEANSCHEMA31#pragma warning disable AS0105// ------------------------------------------------------------------------------------------------// Copyright (c) Microsoft Corporation. All rights reserved.// Licensed under the MIT License. See License.txt in the project root for license information.// ------------------------------------------------------------------------------------------------namespace Microsoft.eServices.EDocument;using System.Azure.Identity;using System.Environment;table 6107 "E-Documents Setup"{    Access = Internal;    InherentEntitlements = RIX;    InherentPermissions = RX;    ReplicateData = false;    ObsoleteReason = 'This table is obsolete and should not be used.';    ObsoleteState = Pending;    ObsoleteTag = '28.0';    fields    {        field(1; Id; Integer)        {            DataClassification = SystemMetadata;            AutoIncrement = true;        }        field(2; "New E-Document Experience"; Boolean)        {            DataClassification = CustomerContent;        }    }    keys    {        key(PK; Id)        {            Clustered = true;        }    }    procedure IsNewEDocumentExperienceActive(): Boolean    var        EnvironmentInformation: Codeunit "Environment Information";        TenantId: Text;        ListOfAvailableCountries: List of [Text];    begin        Clear(Rec);        if Rec.FindFirst() then            if Rec."New E-Document Experience" then                exit(true);        if TryGetAadTenantId(TenantId) then            if TenantId in [                '7bfacc13-5977-43eb-ae75-63e4cbf78029',                '5d02776e-8cf2-4fae-8cac-a52cfdfbe90f',                'f0ac72d1-c1b3-4c2a-a196-8fb82cac5934',                '4cde9473-edc6-464d-98c9-921bb36bab03',                '1fe0f01e-1d4a-4e55-86d7-c45a5b9bf1a6',                '62c3bd14-7298-4281-a12a-ec3a78c22957',                'e5afa896-1f57-4c74-b9cd-65638c0f77da'            ] then                exit(true);        if EnvironmentInformation.GetEnvironmentSetting('EnableNewEDocumentExperience') <> '' then            exit(true);        ListOfAvailableCountries := GetListOfNewExperienceCountries();        ListOfAvailableCountries.Add('W1');        exit(ListOfAvailableCountries.Contains(EnvironmentInformation.GetApplicationFamily()));    end;    internal procedure GetListOfNewExperienceCountries(): List of [Text]    var        CountryList: List of [Text];    begin        CountryList.Add('AU');        CountryList.Add('BE');        CountryList.Add('CA');        CountryList.Add('DE');        CountryList.Add('DK');        CountryList.Add('ES');        CountryList.Add('FR');        CountryList.Add('GB');        CountryList.Add('IT');        CountryList.Add('NL');        CountryList.Add('NO');        CountryList.Add('NZ');        CountryList.Add('SE');        CountryList.Add('US');        exit(CountryList);    end;    [TryFunction]    local procedure TryGetAadTenantId(var TenantId: Text)    var        AzureADTenant: Codeunit "Azure AD Tenant";    begin        TenantId := AzureADTenant.GetAadTenantId();    end;    [InherentPermissions(PermissionObjectType::TableData, Database::"E-Documents Setup", 'I')]    internal procedure InsertNewExperienceSetup()    begin        // Only to be used by tests.        if Rec.FindFirst() then            exit;        Rec."New E-Document Experience" := true;        Rec.Insert();    end;}#pragma warning restore AS0105#endif