To run a batch to check for visa expiry date of employees and send an email if visa expires in a month in Dynamics NAV
This article focuses on to creating a batch to run everyday to check for employee’s visa expiry date. If the visa expires in a month an email notification is sent to the HR Manager about the visa expiry of the respective employee.
Microsoft Dynamics NAV 2017
- Create a new codeunit with id and name.
- Set up the SMTP mail setup in NAV.
3. In the Globals (Ctrl+G),create a record for employee table.
4. Create a function and call it on run.
5. Here in the above code calculate the previous months date of the visa expiry date and if the the date is today then an email is send using smtp mail
6. Create a job queue to run every day. Set the start time and end time.
7. An email is sent if today’s date is the previous month date of visa expiry.