The SharePoint connector comes with the SharePoint factbox installed on many pages, but maybe you want the factbox somewhere else?

Not a problem, you can create an extension that takes dependency to the SharePoint Connector and add the fact box to all the pages you need. (Or your partner can if you give them a link to this page).

First add the dependency to your app.json like this:

{
  "id": "23ebd065-b289-4a68-85e3-b8410e360157",
  "name": "SharePoint Connector",
  "publisher": "E Foqus Canada Inc.",
  "version": "1.0.0.10"
}

Then add one or more pageextension objects to cover the places you need the factbox. Use the below snippet as a template. The only thing you need to do, is edit the first line with:

  • Give it an object number
  • Give it an name
  • Replace the “Page Name” with the name of the page
pageextension 50000 "Extend a page" extends "Page Name"
{
    layout
    {
        addfirst(factboxes)
        {
            part(SharePointPart_EFQ; "SharePoint Factbox EFQ")
            {
                ApplicationArea = All;
                Visible = SharePointActivated;
            }
        }
    }
    trigger OnAfterGetCurrRecord()
    var
        Ref: RecordRef;
        Parms: Dictionary of [Text, Text];
        PageTaskId: Integer;
    begin
        Ref.GetTable(Rec);
        CLEAR(Parms);
        Parms.Add('folder', CurrPage.SharePointPart_EFQ.Page.PrepareFill(Ref));
        CurrPage.EnqueueBackgroundTask(PageTaskId, Codeunit::"Factbox Background Task EFQ", Parms, 30000, PageBackgroundTaskErrorLevel::Warning);
    end;

    trigger OnPageBackgroundTaskCompleted(TaskId: Integer; Results: Dictionary of [Text, Text])
    begin
        CurrPage.SharePointPart_EFQ.Page.FinishFill(Results);
    end;

    trigger OnPageBackgroundTaskError(TaskId: Integer; ErrorCode: Text; ErrorText: Text; ErrorCallStack: Text; var IsHandled: Boolean)
    begin
        CurrPage.SharePointPart_EFQ.Page.FillError(ErrorText);
    end;

    trigger OnOpenPage()
    var
        TableMapping: Record "Table Mapping EFQ";
        Ref: RecordRef;
    begin
        Ref.GetTable(Rec);
        SharePointActivated := TableMapping.NeedsFactBox(Ref.Number());
    end;

    var
        SharePointActivated: Boolean;
}

That’s it, now you have added the SharePoint connector to the page and connected it to the data (Rec).

Author: Erik Hougaard, Managing Partner, E Foqus Canada

Erik Hougaard Dynamics 365 Business Central

Being part of the Microsoft Dynamics NAV community since 1990, Erik Hougaard has worked with every version and visited all corners of the system. Worked with NAV for the biggest companies in Denmark and across numerous industries. Erik has been awarded a Microsoft MVP Award for his Dynamics NAV contributions every year since 2014. Erik developed a 3000 users Dynamics NAV system for A.P.Møller Mærsk (MAERSK) from 1999 to 2013.