Send Email Then Delete Order - E-ship Used

Savatage
Member Posts: 7,142
I would like a report that runs thru some "selected" orders - sends a "Sales Confirmation Email"
then deletes the order.
The email is easily sent but I cannot delete the order. Apparently when the email is sent a field
called E-Mail Notification Handled (boolean) is update. So when I go to delete the order it says
Anyways around this? I would like to mass notify & delete selected orders that we will not ship. doing 100's one at a time sucks. I guess I could call another report that does the deleting :-k
then deletes the order.
The email is easily sent but I cannot delete the order. Apparently when the email is sent a field
called E-Mail Notification Handled (boolean) is update. So when I go to delete the order it says
"Another user has modified this Sales Header after you have retrieved it from the database"
"Enter your changes again in the updated window, or start the interupped activity again"
"Identification Fields & Values"
Document Type='Order',No.='1234567'
OnAfterGetRecord() SendNotificationEmail; DeleteOrder; SendNotificationEmail() emailmgt.SendSalesConfirmation("Sales Header",TRUE); DeleteOrder() "Sales Header".DELETE;
Anyways around this? I would like to mass notify & delete selected orders that we will not ship. doing 100's one at a time sucks. I guess I could call another report that does the deleting :-k
0
Comments
-
You could break the processes into 2 steps. Send the e-mails first then another process to delete it.Confessions of a Dynamics NAV Consultant = my blog
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book0 -
yea it looks like i need to run or runmodal a deletion report.
I'll mark it as solved because that does work. Hate to use two report up0 -
Savatage wrote:yea it looks like i need to run or runmodal a deletion report.
I'll mark it as solved because that does work. Hate to use two report up
A pack of 100 report is very economical considering what you're getting out of Navision.Confessions of a Dynamics NAV Consultant = my blog
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book0 -
is
SendNotificationEmail()
emailmgt.SendSalesConfirmation("Sales Header",TRUE);
CallbyValue or CallbyReference (Flag VAR)?Do you make it right, it works too!0 -
I think changing the DeleteOrder function to
DeleteOrder() "Sales Header".GET("Sales Header"."Document Type","Sales Header"."No."); "Sales Header".DELETE;
is the way to go.0 -
your right - here's the final
OnAfterGetRecord() SendNotificationEmail; DeleteOrder; OnPostDataItem() SendNotificationEmail() EMailMgt.SendSalesConfirmation("Sales Header",TRUE); DeleteOrder() "Sales Header".LOCKTABLE; "Sales Header".GET("Sales Header"."Document Type","Sales Header"."No."); "Sales Header".DELETE;
0 -
Ouch just realized it just deletes the Header & Leaves the LINES!!!!!0
-
"Sales Header".DELETE; <- this delete only the Header, not the lines, not the dimensions, not the comments, and so on.
I was wondering why you doesn't make a "Sales Header".delete(true);, but i didn't say anything because i thought it was not the whole code (sorry) and you delete the other tables some lines later ....
Regards
RenéDo you make it right, it works too!0 -
Yea - over looked it. not a problem
create a boolean in the sales line table - if header exists, took 2 seconds.
Selected all that said no & & deleted them - then removed the field.
Thanks for your input!0 -
there are no Dimensions for the header or comments or other related tables?Do you make it right, it works too!0
-
-
Hi Harry,
Just for future reference, if you use "Sales Header".DELETE( TRUE ); -it will run the code in the ondelete trigger of the sales header table which delete the sales lines and all depending tables.0 -
yeah I know , slipped my mind - that's what happens when you rush at the end of the day :oops: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