FAQ categories
Narrow down your search
You can add the Document Archive factboxes to other/your own pages.
View the Code Sample to see how you can add the factboxes to the "Assembly Order" page.
Please note that you should also implement an event subscriber for the following event:
• WSB_DCAFileMgt.wlEvpOnSetPrimaryValues
- Allows you to specify the primary key field values given a RecordRef
of the source table record that the file should be linked to.
For example. to add support for the "Production BOM Header
" table, you could add the following event subscriber:
[EventSubscriber(ObjectType::Codeunit, Codeunit::WSB_DCAFileMgt, 'wlEvpOnSetPrimaryValues', '', false, false)] local procedure OnSetPrimaryValues(pRecRef: RecordRef; var vSourceNo: Code[20]; var vIsHandled: Boolean) var ProdBOMHdr: Record "Production BOM Header"; begin if pRecRef.Number <> Database::"Production BOM Header" then exit; pRecRef.SetTable(ProdBOMHdr); vSourceNo := ProdBOMHdr."No."; vIsHandled := true; end;
Document Archive offers two types of factboxes:
You can add these factboxes and need to properly set up the SubPageLink property to specify the table and primary key link for the records that are shown on the page to which you are adding the factboxes.
pageextension 70257130 WSB_AssemblyOrderDCA extends "Assembly Order"
{
layout
{
addfirst(Factboxes)
{
part(WSB_DCACategoryFactBox; WSB_DCACategoryFactBox)
{
ApplicationArea = All;
Enabled = WSB_DCACategoryFactBoxVisible;
#pragma warning disable AL0603
SubPageLink = TableNoFilter = const(Database::"Assembly Header"), SourceTypeFilter = field("Document Type"), SourceNoFilter = field("No.");
#pragma warning restore AL0603
Visible = WSB_DCACategoryFactBoxVisible;
}
part(WSB_DCAFileFactBox; WSB_DCAFileFactBox)
{
ApplicationArea = All;
Enabled = WSB_DCAFileFactBoxVisible;
#pragma warning disable AL0603
SubPageLink = TableNo = const(Database::"Assembly Header"), SourceType = field("Document Type"), SourceNo = field("No.");
#pragma warning restore AL0603
Visible = WSB_DCAFileFactBoxVisible;
}
}
}
var
WSB_DCACategoryFactBoxVisible: Boolean;
WSB_DCAFileFactBoxVisible: Boolean;
trigger OnAfterGetCurrRecord()
begin
CurrPage.WSB_DCACategoryFactBox.Page.wgFncSetRecordId(Rec.RecordId());
CurrPage.WSB_DCAFileFactBox.Page.wgFncSetRecordId(Rec.RecordId());
end;
trigger OnOpenPage()
begin
WSB_DCACategoryFactBoxVisible := CurrPage.WSB_DCACategoryFactBox.Page.wgFncShowFactBox();
WSB_DCAFileFactBoxVisible := CurrPage.WSB_DCAFileFactBox.Page.wgFncShowFactBox();
end;
}