Skip to main content

Notifications

Announcements

No record found.

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

Delete multiple document attachement

(1) ShareShare
ReportReport
Posted on by 95

Hi everybody,

We have the following case, we need to delete multiple documents from the table in the picture, we need to do it for Purchase orders and posted purchase orders, I'm trying with add-in edit excel which works but only for one document at a time.

Any idea for a way to do it by batch

pastedimage1670601386636v2.png

Thanks in advance if someone can help me

  • RE: Delete multiple document attachement

    Hi

    Thanks for your answer we'll check this option.

    Best regards.

  • Suggested answer
    pankaj.k Profile Picture
    pankaj.k 962 on at
    RE: Delete multiple document attachement

    Hi Alejandro,

    Please use the below code that will help to delete document one by one  on the bases of Document No..

    report 60005 DeleteAttechment
    {
        UsageCategory = ReportsAndAnalysis;
        ApplicationArea = All;
        ProcessingOnly = true;
        Caption = 'Delete Attechment';

        dataset
        {
            dataitem(DocumentAttachment; "Document Attachment")
            {
                trigger OnPreDataItem()
                begin
                    DocumentAttachment.SetFilter("No.", DocumentNoVar);
                end;

                trigger OnAfterGetRecord()
                begin
                    if Confirm(DocumentAttachment."No.") then
                        DocumentAttachment.Delete(true);
                end;

            }
        }

        requestpage
        {
            layout
            {
                area(Content)
                {
                    group(GroupName)
                    {
                        field(DocumentNoVar; DocumentNoVar)
                        {
                            ApplicationArea = All;
                            TableRelation = "Document Attachment"."No.";

                        }
                    }
                }
            }

        }
        var
            DocumentNoVar: Text;

    }
    Have a great day!

    Don't forget to help the community by verifying the answer if your question has been answered. It will let others know that the topic has verified answer.

    Thanks,

    Contact Info: kuwalpankaj97@gmail.com
  • RE: Delete multiple document attachement

    Hi

    Thanks for your answer, It's possible that you can give me what steps I must follow to do the batch job?

  • Suggested answer
    pankaj.k Profile Picture
    pankaj.k 962 on at
    RE: Delete multiple document attachement

    Hi Alejandro,

    you need to create one Batch Job That is based on Table "Document Attachment" Id: 1173

    you can choose  1. "Document  No filter" 2."table no Filter". etc

    Have a great day!

    Don't forget to help the community by verifying the answer if your question has been answered. It will let others know that the topic has verified answer.

    Thanks,

    Contact Info: kuwalpankaj97@gmail.com

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,684 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,414 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans