Search code examples
dynamics-business-centraldynamics-albusinesscentral

You do not have the following permissions on CodeUnit ... Execute


I have an AL extension deployed on a BC V20 On-Prem system (Version: GB Business Central 20.0 (Platform 20.0.37114.38150 + Application 20.0.37253.38230)). It was working fine until a new licence was installed. It also works on a Cloud Sandbox. A brief outline of the purpose of the extension is to provide a custom page with a subform and a report associated with it.

I believe I have permissions set-up correctly in my codeunit:-

Permissions = TableData TrialBalByDimParams = rimd,
          TableData TrialBalanceByDim = rimd,
          TableData "G/L Account" = r,
          TableData "G/L Entry" = r,
          TableData "General Ledger Setup" = r,
          TableData "Dimension Value" = r,
          TableData "Accounting Period" = r;

There's also a permission set (as below) which I have assigned to the current user for all companies.

permissionset 50000 CustomFuncsYW
{
Assignable = true;
Permissions = tabledata TrialBalanceByDim=RIMD,
tabledata TrialBalByDimParams=RIMD,
table TrialBalanceByDim=X,
table TrialBalByDimParams=X,
report CustomTrialBalanceByDim=X,
codeunit CustomTrialBalancePopulator=X,
page TrialBalanceByDim=X,
page TrialBalByDimParams=X,
query GleDv1=X;
}

In Effective Permissions the 'Execute Permission' column does not contain 'Yes' for my CodeUnit (see below). Is this incorrect?

From a Universal Code perspective, I do not have a Target setting in my app.json file. My understanding is, that means its default value is 'Cloud'.

Is there anything else code-wise I can check for that might cause it to work under one licence and not another?

Does this mean it's licence related? If yes, what can I look for in the licence file that may reveal the issue?

Licence details (1) Licence details (2) Licence details (3) Licence tool screenshot


Solution

  • This does indeed look like a license issue. To troubleshoot it and pinpoint the problem, try running the same action under a user account with SUPER permissions. If the same error still occurs, this will eliminate the option of a permission set misconfiguration. To check the license, first of all, you can open the .flf or .bclicense (whichever you use) in Notepad and look at the summary section. It should contain the list of purchased objects, like this:

    ****************************************************************************
    Name                                                                  Amount
    ----------------------------------------------------------------- ----------
    Country Code: Great Britain                                                1
    Dyn365 Business Central Codeunits (100)                                  100
    Dyn365 Business Central Codeunits (each)                                  23
    Dyn365 Business Central Pages (100)                                      300
    Dyn365 Business Central Pages (each)                                      34
    Dyn365 Business Central Premium                                           50
    Dyn365 Business Central Premium - Upgrade                                100
    Dyn365 Business Central Queries (100)                                    100
    Dyn365 Business Central Reports (100)                                    100
    Dyn365 Business Central Tables (10)                                       60
    Dyn365 Business Central Tables (each)                                      4
    Dyn365 Business Central XML Ports (100)                                  100
    
    ****************************************************************************
    

    I assume the error that you encounter refers to the custom codeunit CustomTrialBalancePopulator. So at least one custom codeunit must be present in this list. If this part is ok, check the assigned IDs in the license permissions. GB version of BC 20 has a report License Permissions which you can run, or simply open the table License Permission in the browser:

    <BC Service URL>?table=2000000043
    

    In this table, check if your codeunit ID has the execution permission assigned. If not - the license should be recreated with correct permission.

    Correct list of objects with custom codeunit permissions should be like this: enter image description here

    Regarding the universal code - that's correct, if the target value is not specified in the app.json, the default is "Cloud".

    Note that this object ID assignment only applies to BC on prem, cloud deployments don't need this hassle, therefore it works for you in a cloud sandbox.