Skip to main content

Notifications

Announcements

No record found.

Business Central forum
Suggested answer

Making Attachments Mandatory in Purchase Order or Sales Order without customization

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:
  • Suggested answer
    Netjacker2097 Profile Picture
    Netjacker2097 184 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 64,622 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 8,311 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

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 288,768 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,985 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans