How keep a changed register

Leroy
Member Posts: 199
Hi everybody; I've the following code
Mail is codeunit Mail
This is on "Shipment date" field form Sales line table. It sends an e-mail to the product manager from the item when the shipment date modifies, and puts the new date; it runs perfectly. But, how can I do to put also the old date, I mean, the date that has been changed?.
Thanks for help.
IF (xRec."Shipment Date"<>0D) THEN BEGIN IF "Cód. Product manager" = 'PM-EDY' THEN BEGIN Mail.NewMessage('adm@company.com','','Has been modify the date form the item ' + "No."+' from order '+"Document No."+'date'+ (FORMAT("Shipment Date")), '','',FALSE); END; END;
Mail is codeunit Mail
This is on "Shipment date" field form Sales line table. It sends an e-mail to the product manager from the item when the shipment date modifies, and puts the new date; it runs perfectly. But, how can I do to put also the old date, I mean, the date that has been changed?.
Thanks for help.
0
Comments
-
Leroy wrote:Hi everybody; I've the following code
IF (xRec."Shipment Date"<>0D) THEN BEGIN IF "Cód. Product manager" = 'PM-EDY' THEN BEGIN Mail.NewMessage('adm@company.com','','Has been modify the date form the item ' + "No."+' from order '+"Document No."+'date'+ (FORMAT("Shipment Date")), '','',FALSE); END; END;
Mail is codeunit Mail
This is on "Shipment date" field form Sales line table. It sends an e-mail to the product manager from the item when the shipment date modifies, and puts the new date; it runs perfectly. But, how can I do to put also the old date, I mean, the date that has been changed?.
Thanks for help.0 -
Thanks for reply. But I've put (xRec."Shipment Date"<>0D) because I don't want the the e-mail sends on first time. How should be the code for it?.
Thanks.0 -
Leroy wrote:Thanks for reply. But I've put (xRec."Shipment Date"<>0D) because I don't want the the e-mail sends on first time. How should be the code for it?.
Thanks.
then you could do something like :Mail.NewMessage('adm@company.com','','Has been modify the date form the item ' + "No."+' from order ' + "Document No." + ' original date : '+ (FORMAT(xrec,"Shipment Date") + ' new date : ' + FORMAT(xrec,"Shipment Date"), '','',FALSE);
0 -
Yes!!, it works perfectly =D> .
Thanks you very much for your help and time.0 -
Just one tip:
IF "Cód. Product manager" = 'PM-EDY' THEN BEGIN
Using "magic constants" is not good design... :whistle:0 -
Thanks. Another question if you're so kind :roll: . The problem with this code is that a mail is send with only put the cursor on the field, not only when it changes. Is there any way that it sends a mail when the information is changed not putting the mouse on the field?.
Also I've noticed that it sends and e-mail the first time that I put the date. I supossed that putting (xRec."Shipment Date"<>0D) the mail sends when the field modifies, but it doesn't work. What could be the problem also?
I put the code:IF (xRec."Shipment Date"<>0D) THEN BEGIN IF "Cód. Product manager" = 'PM-EDIE' THEN BEGIN CodeMail.NewMessage('mail@mail.com','','The date is modified '+FORMAT(xRec."Shipment Date") + ' date '+(FORMAT("Shipment Date"))+' Item: ' + "No."+' Order: '+"Document No.", '','',FALSE); END; END;
Thanks again for help.0 -
What about something like:
if (xRec."Shipment Date"<>xRec."Shipment Date") and ("Shipment Date"<>0D) then
- it means "if date was changed and is filled by some value..."0 -
Yes, it works!!!. =D>
Thanks for help and time.0 -
I have typo in my example, correct one is:
if (xRec."Shipment Date"<>"Shipment Date") and ("Shipment Date"<>0D) then
0 -
Yes, thanks, I've had "corrected", but the idea was the important. My code remains like this:
IF (xRec."Shipment Date"<>0D) AND ((FORMAT(xRec."Shipment Date"))<>(FORMAT("Shipment Date")))
Thanks again for help.0 -
Just remove the "Format" because it is not needed and it have no meaning there...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