Plur-e
Business Central Panel

Extension methods and financial reports

How a consultant adds methods to a customer's Business Central from a per-tenant extension (PTE) without touching the Plur-e app, and how financial reports run by API.

Quick answer

The Plur-e extension runs Business Central financial reports by name for the app, the Admin Center and AI assistants, and lets a consultant add methods from a per-tenant extension (PTE) without touching the AppSource app. Buying and licences live in the Plur-e Store on the web and in the Admin Center, never in Business Central.

Financial Reports by API

The extension can run a Financial Report of Business Central (version 23 or later) by name. It exposes two methods, ListFinancialReports (name and description) and RunFinancialReport:

ParameterMeaning
ReportNameRequired. The financial report.
From, ToDates as YYYY-MM-DD. To defaults to the work date and From to the first day of To's month.
ColumnLayoutOptional. Defaults to the report's own column definition.
Dimension1Filter, Dimension2Filter, GLBudgetFilterOptional filters.

You get the rows (line number, row number, description, bold, indentation) and one value per visible column. The methods require the Business Central Panel module and are used by the MCP tools and by report views of the Capability Studio.

Add methods from a PTE

A customer's own logic belongs in their PTE, not in the Plur-e app. erp/processrequest runs built-in methods first; when no built-in method has the requested name, it looks for a value of the extensible enum "PLU Process Method Ext" with that exact name and runs its implementation of the interface "PLU IProcess Method":

  • Run(Parameters: JsonToken): Text runs the method and returns the response text, usually JSON.
  • Describe(): JsonObject describes it for the catalogue: name, kind (Read, Write or Post), description and parameters (name, type, required).

Example, a read method that counts a customer's open sales orders. Use your own prefix and ID range.

enumextension 50100 "ACME Process Method" extends "PLU Process Method Ext"
{
    value(50100; ACMEOpenOrdersCount)
    {
        Caption = 'ACMEOpenOrdersCount', Locked = true;
        Implementation = "PLU IProcess Method" = "ACME Open Orders Count";
    }
}

codeunit 50100 "ACME Open Orders Count" implements "PLU IProcess Method"
{
    procedure Run(Parameters: JsonToken): Text
    var
        SalesHeader: Record "Sales Header";
        ParamsObject: JsonObject;
        ParamsArray: JsonArray;
        FirstToken: JsonToken;
        CustomerToken: JsonToken;
        Result: JsonObject;
        Output: Text;
    begin
        if Parameters.IsArray() then begin
            ParamsArray := Parameters.AsArray();
            ParamsArray.Get(0, FirstToken);
            ParamsObject := FirstToken.AsObject();
        end else
            ParamsObject := Parameters.AsObject();
        if not ParamsObject.Get('CustomerNo', CustomerToken) then
            Error(CustomerNoRequiredErr);

        SalesHeader.SetRange("Document Type", SalesHeader."Document Type"::Order);
        SalesHeader.SetRange("Sell-to Customer No.", CustomerToken.AsValue().AsText());
        Result.Add('openOrders', SalesHeader.Count());
        Result.WriteTo(Output);
        exit(Output);
    end;

    procedure Describe(): JsonObject
    var
        Description: JsonObject;
        ParameterList: JsonArray;
        Parameter: JsonObject;
    begin
        Parameter.Add('name', 'CustomerNo');
        Parameter.Add('type', 'Text');
        Parameter.Add('required', true);
        ParameterList.Add(Parameter);

        Description.Add('name', 'ACMEOpenOrdersCount');
        Description.Add('kind', 'Read');
        Description.Add('description', 'Counts the open sales orders of a customer.');
        Description.Add('parameters', ParameterList);
        exit(Description);
    end;

    var
        CustomerNoRequiredErr: Label 'The parameter CustomerNo is required.';
}

After installing the PTE:

  1. The name of the enum value is the ProcessMethod the API sends. Built-in methods keep priority, so choose a prefixed name.
  2. ListProcessMethods lists every extension method with its Describe() and the app version. A platform administrator runs Discover methods for the environment, and the new methods enter the catalogue inactive.
  3. A platform administrator activates the ones that should be used. Only active catalogue methods can be used by capabilities and MCP.

Limits

  • The Plur-e app is not modified: a PTE can add methods, not change the built-in ones.
  • The extension needs your administrator to have activated Plur-e in Business Central; without activation there is nothing to refresh.
Was this page helpful?

On this page