Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Suggested answer

Sales orders clean up doesn't work as expected

(1) ShareShare
ReportReport
Posted on by 216
Hi, we have huge salestable and salesline -tables from capacity point of view and would like to delete older sales orders. So for this purpose there is 'Delete sales order' -functionality (Sales and marketing/Periodic tasks/Clean up). First I have to select the sales orders to be deleted:
If I choose e.g. sales orders created before 2019 the query goes like this:
 
And here's the problem: When I press OK, it starts to process the request and it just keeps going and going. Yesterday I waited for 2 hours but it didn't finish. 
Question: What are my options now? I don't prefer going to SQL because I think deleting orders this way is more safe and it probably deletes everything related to sales orders.
Categories:
  • Suggested answer
    Mohamed Amine Mahmoudi Profile Picture
    Mohamed Amine Mahmoudi 11,070 Super User 2024 Season 2 on at
    Sales orders clean up doesn't work as expected
    Hi @Migi,
     
    In this case you need to run the process in batch job.
     
    Best regards,
    Mohamed Amine MAHMOUDI
     
  • Migi Profile Picture
    Migi 216 on at
    Sales orders clean up doesn't work as expected
    Hi, 
    Thank you for your answers. I managed to get results out of one single day in 2019, but it took 10 minutes to process it. I also used 'invoiced' as status filter. So the main problem still remains. If I want to delete all the orders from 2019 it would take days to process it. 
  • Suggested answer
    Mohamed Amine Mahmoudi Profile Picture
    Mohamed Amine Mahmoudi 11,070 Super User 2024 Season 2 on at
    Sales orders clean up doesn't work as expected
    Hi @Migi,
     
    You can also use (YearRange(-6,-6)) method to select all order in 2019.
     
     
    Best regards,
    Mohamed Amine MAHMOUDI
  • Layan Jwei Profile Picture
    Layan Jwei 7,278 Super User 2024 Season 2 on at
    Sales orders clean up doesn't work as expected
    Hi,

    I feel the syntax you put for filters is wrong

    maybe use 1/1/2019 instead of 1.1.2019
     
    they way you filtered status also looks wrong as the open order syntax looks wrong


    As a start try to delete orders created in one day by putting this created date time 12/30/2018..1/1/2019
    and maybe just orders with status invoiced

    make sure this works then make the query cover larger 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

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! 🥳

Start Your Super User Journey Pt 2

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,514 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans