web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested answer

Attachments General Journals

(0) ShareShare
ReportReport
Posted on by 23

Is there a way to add the attachments to general journals?  I know you can do this through Incoming Documents, but we want to use attachments.  I noticed that I could unhide Links and Notes, but the attachment link is still missing.

pastedimage1648053638443v1.png

Looking for what is on the Purchase Invoice.

pastedimage1648053664167v2.png

The DocXtender product uses the base windows so it doesn't work.

Thanks!

Tanya

I have the same question (0)
  • Suggested answer
    MahGah Profile Picture
    15,529 on at
    RE: Attachments General Journals

    Hi

    I think you either need to ask developer to add it there or if you want to use app the following app has it in general journal (see screenshot). But it is a paid app. 

    appsource.microsoft.com/.../PUBID.tecman|AID.clever-document-links|PAPPID.a7359d55-e70d-488d-8fc9-0b5cef655f6e

    Or check with Micro app and see if they can include it 

    micro-apps.com/.../

    pastedimage1648056254358v1.png

  • Suggested answer
    YUN ZHU Profile Picture
    93,874 Super User 2025 Season 2 on at
    RE: Attachments General Journals

    Hi, This can be added by customization.

    Below is an example of a single key.

    https://yzhums.com/11177/

    For the case of multiple primary keys such as General Journals, I have done a test, hope the following can give you some hints.

    Add attachments to vendor bank account card.

    pastedimage1648096305947v1.png

    pastedimage1648096341520v2.png

    pastedimage1648096433411v4.pngpastedimage1648096441009v5.png

    pastedimage1648096453717v6.png

    ageextension 50111 VendorBankAccountCard extends "Vendor Bank Account Card"
    {
        actions
        {
            addfirst(Processing)
            {
                action(DocAttach)
                {
                    ApplicationArea = All;
                    Caption = 'Attachments';
                    Image = Attach;
                    ToolTip = 'Add a file as an attachment. You can attach images as well as documents.';
    
                    trigger OnAction()
                    var
                        DocumentAttachmentDetails: Page "Document Attachment Details";
                        RecRef: RecordRef;
                    begin
                        RecRef.GetTable(Rec);
                        DocumentAttachmentDetails.OpenForRecRef(RecRef);
                        DocumentAttachmentDetails.RunModal();
                    end;
                }
            }
        }
    }
    
    codeunit 50101 DocumentAttachment2
    {
        [EventSubscriber(ObjectType::Page, Page::"Document Attachment Factbox", 'OnBeforeDrillDown', '', false, false)]
        local procedure OnBeforeDrillDown(DocumentAttachment: Record "Document Attachment"; var RecRef: RecordRef);
        var
            VendorBankAccount: Record "Vendor Bank Account";
        begin
            case DocumentAttachment."Table ID" of
                DATABASE::"Vendor Bank Account":
                    begin
                        RecRef.Open(DATABASE::"Vendor Bank Account");
                        if VendorBankAccount.Get(DocumentAttachment."No.") then
                            RecRef.GetTable(VendorBankAccount);
                    end;
            end;
        end;
    
        [EventSubscriber(ObjectType::Page, Page::"Document Attachment Details", 'OnAfterOpenForRecRef', '', false, false)]
        local procedure OnAfterOpenForRecRef(var DocumentAttachment: Record "Document Attachment"; var RecRef: RecordRef; var FlowFieldsEditable: Boolean);
        var
            FieldRef: FieldRef;
            RecNo: Code[20];
            VendorBankCode: Code[20];
        begin
            case RecRef.Number of
                DATABASE::"Vendor Bank Account":
                    begin
                        FieldRef := RecRef.Field(1);
                        RecNo := FieldRef.Value;
                        DocumentAttachment.SetRange("No.", RecNo);
    
                        FieldRef := RecRef.Field(2);
                        VendorBankCode := FieldRef.Value;
                        DocumentAttachment.SetRange("Vendor Bank Number", VendorBankCode);
    
                        FlowFieldsEditable := false;
                    end;
            end;
        end;
    
        [EventSubscriber(ObjectType::Table, Database::"Document Attachment", 'OnAfterInitFieldsFromRecRef', '', false, false)]
        local procedure OnAfterInitFieldsFromRecRef(var DocumentAttachment: Record "Document Attachment"; var RecRef: RecordRef)
        var
            FieldRef: FieldRef;
            RecNo: Code[20];
            VendorBankCode: Code[20];
        begin
            case RecRef.Number of
                DATABASE::"Vendor Bank Account":
                    begin
                        FieldRef := RecRef.Field(1);
                        RecNo := FieldRef.Value;
                        DocumentAttachment.Validate("No.", RecNo);
    
                        FieldRef := RecRef.Field(2);
                        VendorBankCode := FieldRef.Value;
                        DocumentAttachment.Validate("Vendor Bank Number", VendorBankCode);
                    end;
            end;
        end;
    }
    
    tableextension 50100 DocumentAttachmentExt extends "Document Attachment"
    {
        fields
        {
            field(50100; "Vendor Bank Number"; Code[20])
            {
                DataClassification = CustomerContent;
            }
        }
    }
    

    As for the solution, you can also refer to the Attachments button in Sales Order Subform page ( Sales line also contains multiple primary keys). Of course this requires some modification.

    pastedimage1648096376073v3.png

    Hope this will help.

    Thanks.

    ZHU

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,214

#2
Sumit Singh Profile Picture

Sumit Singh 2,145

#3
YUN ZHU Profile Picture

YUN ZHU 1,887 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans