Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

How to remove one item from multiple (like 100 or more) sales order?

(0) ShareShare
ReportReport
Posted on by 15,435

Hi

Sometimes we sell one item but later we realize we cannot source it anymore. Then we need to remove that item from many sales order. Is it any easy way to remove one item from all sales order lines?

If it is not possible OOTB then any ISV? If no  ISV then I assume customization is the path to go or can you do this using Power Automate? 

Thanks 

  • MahGah Profile Picture
    15,435 on at
    RE: How to remove one item from multiple (like 100 or more) sales order?

    Hi Mr Bruvik

    Thank you so much for the code. I will test this in the Sandbox. I really appreciate your help here.

  • Suggested answer
    Inge M. Bruvik Profile Picture
    999 Moderator on at
    RE: How to remove one item from multiple (like 100 or more) sales order?

    A simple custom report will be the best way to do this I think.

    report 50100 DeleteOrderLines
    {
        ApplicationArea = All;
        Caption = 'DeleteOrderLines';
        UsageCategory = Tasks;
        ProcessingOnly = true;
        dataset
        {
            dataitem(SalesLine; "Sales Line")
            {
                trigger OnAfterGetRecord()
                begin
                    If SalesLine."No." ='TheNumberYouNeedToDelete' then SalesLine.Delete(true);
                end;
            }
        }
        requestpage
        {
            layout
            {
                area(content)
                {
                    group(GroupName)
                    {
                    }
                }
            }
            actions
            {
                area(processing)
                {
                }
            }
        }
        
    }
    

    This will run through all your saleslines and delete the ones with the item number you compare with.

    And as always - test in a sandbox.

  • MahGah Profile Picture
    15,435 on at
    RE: How to remove one item from multiple (like 100 or more) sales order?

    DAnny3211  I like your idea about Power Automate. But do you have any example for it? I mean how we can define which item no we want to delete then which function of Power Automate we need to use? If you point me to anything similar it can help a lot.

  • Suggested answer
    DAnny3211 Profile Picture
    9,274 Moderator on at
    RE: How to remove one item from multiple (like 100 or more) sales order?

    hi

    there is no out-of-the-box functionality to remove one item from all sales order lines at once. However, there are several ways you can achieve this, including using an ISV solution, customization, or Power Automate.

    If you're looking for an ISV solution, you can search for available extensions in the Microsoft AppSource marketplace. There are several extensions available that provide features related to inventory management and sales orders.

    If you decide to go for customization, you can either hire a Business Central developer or do it yourself if you have the necessary development skills. Customization involves modifying the code of your Business Central instance to add new functionality or change existing behavior. A developer can help you create a customization that allows you to remove the item from all sales order lines.

    Alternatively, you can use Power Automate to automate the process of removing the item from all sales order lines. You can create a flow that runs whenever the item is marked as "out of stock." The flow can then iterate through all sales order lines that contain the item and remove it.

    In conclusion, there are several ways to remove an item from all sales order lines in Business Central. You can use an ISV solution, customize the code, or create a flow in Power Automate.

    DAniele

  • Suggested answer
    Tech-Lucky Profile Picture
    840 on at
    RE: How to remove one item from multiple (like 100 or more) sales order?

    There is an option for customization you can make the XML Port where you need to define 2 fields one is Sales Order No and Other is Item No. and you can do the code on the XML port to delete the Uploaded Files from the Sales Line once this uploader is made this can be done by a customer also he just needs to prepare the CSV file and Upload it.

    if you don't know how to do customization then you can take my help.

    To help other members of the community please verify my answer if you find my answer helpful

  • Suggested answer
    MahGah Profile Picture
    15,435 on at
    RE: How to remove one item from multiple (like 100 or more) sales order?

    Thank you both

    configuration package will not work since 1) this needs to be done by end user such as customer service 2) it is risky since it could cause deleting of entire sales line table

    Looks like the only option is development since I could not find any ISV

  • Suggested answer
    YUN ZHU Profile Picture
    79,097 Super User 2025 Season 1 on at
    RE: How to remove one item from multiple (like 100 or more) sales order?

    Hi, Maybe you can try to use Configuration Package.

    Export all Sales Lines -> Delete all rows of the item in Excel file -> Enable Delete Table Records Before Processing, and then import the excel.

    pastedimage1681085458687v1.png

    Hope this helps.

    Thanks.

    ZHU

  • black_s Profile Picture
    328 on at
    RE: How to remove one item from multiple (like 100 or more) sales order?

    Hi ,

    This may assist.

    Export the sales line table with a filter of that item number.

    Then blank out the excel leaving it with the doc no, line no only populated.

    Import back and overwrite with blank data

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,245 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,925 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans