Batch Archive

supp85
Member Posts: 76
Hello all,
I am trying to create a report to batch archive quotes however i'm not entirley sure how to go about it, can anyone help please?
Thank you
I am trying to create a report to batch archive quotes however i'm not entirley sure how to go about it, can anyone help please?
Thank you
0
Comments
-
Here's how you would go about doing something like that:
- First you do the process manually, to understand how it works. This will tell you where to look when you start automising this process.
- So, create a quote, and archive it manually.
- Open the objects in design mode and figure out what objects are involved.
- Run Code Coverage to get a list of all the objects.
- Run the debugger and step through the code. This is probaby the most useful way to get a real grip on how it works
- Then when you have figured out what the process is, which steps you have to go through, you can write the C/AL code to automate the process
0 -
I think i may have done it woo hoo!! I entered the following code within the OnAfterGetRecord trigger:
SalesHead.SETRANGE("Document Type","Document Type"::Quote);
SalesHead.SETRANGE("Sales Quote Status","Sales Quote Status"::Lost);
SalesHead.SETRANGE(Status, Status::Released);
ArchiveManagement.StoreSalesDocument("Sales Header",TRUE);
DELETE(TRUE);
It seems to be working however if you do see any flaws within it please do let me know.0 -
Thank you for your reply Denster appreciate it0
-
supp85 wrote:I think i may have done it woo hoo!! I entered the following code within the OnAfterGetRecord trigger:
SalesHead.SETRANGE("Document Type","Document Type"::Quote);
SalesHead.SETRANGE("Sales Quote Status","Sales Quote Status"::Lost);
SalesHead.SETRANGE(Status, Status::Released);
ArchiveManagement.StoreSalesDocument("Sales Header",TRUE);
DELETE(TRUE);
It seems to be working however if you do see any flaws within it please do let me know.
In general, you would typically not program filters in the OnAfterGetRecord trigger. Either you program filters in the OnPreDataItem trigger, or you let the user set filters in the Sales Header request form.0 -
One suggestion.
If there is no commit in the code that is executed, it would be nice to place a commit between each quote and maybe a SLEEP for a couple of seconds, just to make sure you don't block anyone. If you have a lot of quotes and the batch job needs a lot of time you might delay the rest of the processes. I've done the same not only with archiving, but also with posting, so it can be done...0 -
[Topic moved from 'NAV Tips & Tricks' forum to 'NAV/Navision' forum]Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
Thank you both for your replies, they are actually the same Variable not quite sure why i named them differently, I agree with moving the filters to the OnPreDataItem trigger thank you, just a quick question in regards to the filter, would it be better to i apply them within the report properties?
I'll try out the commit function, just not sure whether it would be worthwhile as the report wouldn't be used very frequently.0 -
Different variable names means different variables, the computer doesn't know that you mean to use the same one.
If those filters are supposed to always be used then I'd personally set them in the DataItemTableView property of the dataitem.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions