Skip to main content
Business Central forum
Suggested answer

Making Attachments Mandatory in Purchase Order or Sales Order without customization

editSubscribe (1) ShareShare
ReportReport
Posted on by 7

Hi Business Central community,

I am currently facing a requirement in Business Central and would greatly appreciate your insights.

I need to make attachments mandatory in both Purchase Orders and Sales Orders before they can be successfully posted. I'm specifically looking for a solution that does not involve customization, if possible. We also need a option to manually override this attachment wherever not needed. 

Has anyone encountered a similar requirement, and if so, could you please share your approach or any built-in features within Business Central that can help achieve this without resorting to customization?

Thank you in advance for your expertise and assistance!

Categories:
Attachments
  • Suggested answer
    Netjacker2097 Profile Picture
    Netjacker2097 115 on at
    Making Attachments Mandatory in Purchase Order or Sales Order without customization
    Hi,
     
    i have this for our smaller operation which might help you for what you need. it just remind them to attached when they go in to the sales order or add any new lines. there is no over ride built in. once file is uploaded, the message will stop.
    hopefully its not too over kill, it works for the small operations:
     
    pageextension 80125 salesOrderExt extends "Sales Order"
    {
        layout
        {
     
        }
        trigger OnAfterGetCurrRecord()
        var
            SalesOrderHeader: Record "Sales Header";
            SalesOrderAttachmentExist: Boolean;
        begin
            SalesOrderHeader := Rec;
            // Check if the sales order is being posted
            if SalesOrderHeader.Status = SalesOrderHeader.Status::Open then begin
                // Check if there are any attachments associated with the sales order
                SalesOrderAttachmentExist := CheckSalesOrderAttachments(SalesOrderHeader."Document Type", SalesOrderHeader."No.");
     
                // If no attachments exist, display a warning message
                if not SalesOrderAttachmentExist then begin
                    MESSAGE('No attachments have been applied to this sales order. Please attach necessary documents before posting.');
                end;
            end;
        end;
     
        // Function to check if attachments exist for a given sales order
        local procedure CheckSalesOrderAttachments(DocumentType: Enum "Sales Document Type"; DocumentNo: Code[20]): Boolean;
        var
            SalesOrderAttachment: Record "Document Attachment";
        begin
            // Filter attachments related to the specified sales order
            SalesOrderAttachment.SETRANGE("Document Type", DocumentType);
            SalesOrderAttachment.SETRANGE("No.", DocumentNo);
     
            // Check if any attachments exist
            if SalesOrderAttachment.ISEMPTY then begin
                exit(false);
            end;
     
            // Attachments found
            exit(true);
        end;
    }
  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 60,007 Super User on at
    Making Attachments Mandatory in Purchase Order or Sales Order without customization
    Unfortunately, even mandatory input fields can't be done. . . .
    More details: Dynamics 365 Business Central: How to make a field mandatory
     
    As of now, this requires customization anyway.
     
     
    Thanks
    ZHU
  • Suggested answer
    Valentin Castravet Profile Picture
    Valentin Castravet 4,124 Super User on at
    Making Attachments Mandatory in Purchase Order or Sales Order without customization
    This is not possible. In these cases the business process needs to be modified so the users posting purchase and sales orders are required and held accountable for ensuring that the document has the required attachments prior to posting. 
     
     
    Valentin Castravet
    Zander ERP Services

Helpful resources

Quick Links

New Blog Features Released!

Check out the new community blog features for viewers and authors…

Setting Up Knowledge Sources for Copilot…

Look at how configuring a comprehensive knowledge base is crucial…

Demystifying Copilot with Georg Glantschnig…

Industry experts answer burning questions directly from our amazing Community…

Leaderboard

#1
Andre Arnaud de Calavon Profile Picture

Andre Arnaud de Cal... 283,126 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 222,646 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,138

Featured topics

Product updates

Dynamics 365 release plans