Skip to main content

Notifications

Announcements

No record found.

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

Attachments General Journals

(0) ShareShare
ReportReport
Posted on by 6

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

  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 75,595 Super User 2024 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

  • Suggested answer
    MahGah Profile Picture
    MahGah 15,433 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

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

Congratulations 2024 Spotlight Honorees!

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December!

Congratulations to our December super stars! 🥳

Get Started Blogging in the Community

Hosted or syndicated blogging is available! ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,642 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,371 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans