Notification for change in document

Hi Folks,

My scenario is that i have created a sales order and also warehouse shipment is created. Now for some reason user has revised the order.

I want an email to be send to warehouse team that will show the field which is been revised and also the new and old values.

kindly suggest

Shoot a report to the Warehouse Employee over Email every time u make Warehouse Shipment and that will be the best solution for your case.

Just make it Flag based so that it only shoot the email if the flag is manually enabled by the user who actually did the changes and e wants a notification email to be sent.

Hi,

Just an idea on the top of my head, maybe you can use the change log entries.

  1. Activate the change log.
  2. Select only the table and fields that you want to monitor ( how to do step 1 & 2 : https://www.archerpoint.com/blog/Posts/change-logs-and-microsoft-dynamics-nav-2016)
  3. Create a codeunit that will collect the changes and send them to the warehouse team via e-mail.
  4. Create a job queue entry with that codeunit (you can execute it every day for example).

There are some solutions to be sure to not send the same changes multiple times (codeunit executed every day with a filter on date, log table, etc).

I hope this will help you !

Can you explain in briefly.

i only want to send email with the order is revised.

Actually in my change log setup sales header and sales line contain all the fields and i cannot set log modification for some fields only

Is it because you have to log every fields ?

If so, then you can filter the “Change Log Entry” table. For example, if you want to retrieve all the modifications every day on table 36 (Sales Header), you can do this in a codeunit :

StartDay := CREATEDATETIME(TODAY,0T); //Datetime
EndDay := CREATEDATETIME(TODAY,TIME); //Datetime

ChangeLogEntry.RESET; //Table 405
ChangeLogEntry.SETRANGE("Table No.",36); //Filter on Sales Header
ChangeLogEntry.SETEANGE("Type of Change",ChangeLogEntry."Type of Change"::Modification);
ChangeLogEntry.SETRANGE("Date and Time",StartDay,EndDay);
IF ChangeLogEntry.FINDSET THEN
BEGIN
	SMTPMailSetup.GET; //Table 409

	SMTPMail.CreateMessage('SenderName','Sender mail','Recipient(s) mail(s)','Subject','',TRUE); //Codeunit 400
	SMTPMail.AppendBody('Hi,');
	SMTPMail.AppendBody('<br><br>'); // NewLine
	
	REPEAT

		SMTPMail.AppendBody('Order No. : ' + ChangeLogEntry."Primary Key Field 1 Value"); // Sales Header No.
		SMTPMail.AppendBody('<br>');
		ChangeLogEntry.CALCFIELDS("Field Caption");
		SMTPMail.AppendBody(' Field : ' + ChangeLogEntry."Field Caption"); // Modified Field
		SMTPMail.AppendBody(' Old Value : ' + ChangeLogEntry."Old Value"); // Old value
		SMTPMail.AppendBody(' New Value : ' + ChangeLogEntry."New Value"); // New value
		SMTPMail.AppendBody(' Modified By : ' + ChangeLogEntry."User ID"); // Modified By
		SMTPMail.AppendBody('<br><br>');

	UNTIL ChangeLogEntry.NEXT = 0;

	SMTPMail.AppendBody('<br><br>');
	SMTPMail.AppendBody('Kind Regards');
	SMTPMail.AppendBody('<hr>');
	SMTPMail.AppendBody('*** This is an automatically generated email, please do not reply.');
	SMTPMail.Send;
END;

Then you create a job queue with that codeunit and schedule it every day at the end of the day.

A better way would be to create a report that gathers the modifications, and send that report via e-mail.

You must be having couple of fields so on the basis of that you need to track however you want either with a flag or something else. You may pull the entries from change log entries as well but it may affect somehow performance.