web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

DueDate

(0) ShareShare
ReportReport
Posted on by

hi experts,

I want to send a mail if duedate is greater 5 days of today 

duedate := 25/4/2018

DuedateCalculation := calcdate(>=+5D, duedate)

TodayDate := TODAY;

IF DuedateCalculation  = >Today then

SMTP.AppendBody(Text009);
SMTP.AppendBody(Text010);
SMTP.AppendBody(Text011+' '+COPYSTR(customer."No.",1,50)+','+' '+COPYSTR(customer.Name,1,50)+ ' '+Text012+FORMAT(dueamounts)+Text0017);
SMTP.AppendBody(Text010);
SMTP.AppendBody(Text013);
SMTP.AppendBody(Text014);
SMTP.AppendBody(Text015);
SMTP.AddAttachment(path,PdfDocPath);
SMTP.AddAttachment(path2,pdf2);
SMTP.Send;

Its not working please tell me i want to send a email expired due date (after 5 date of due date i need to send a mail ) i dont know how to calculate the date. please give any solution.

Thank you

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Stefano Demiliani Profile Picture
    37,166 Most Valuable Professional on at

    DueDateCalculation := CALCDATE('+5D',TODAY);

    IF DueDate  > DueDateCalculation then

    ...

  • Community Member Profile Picture
    on at

    Hi Stefano,

    Thank you so much for your reply , i am using this function for auto email ,i want to send a email expired due date (after 5 date of due date i need to send a mail ) Sunday server will be off   email not sending

    //Saturday

    duedate := 03/05/2017

    Saturday date := 08/05/2017

    DueDateCalculation := CALCDATE('+5D',duedate );

    Today := 08/05/2017

    if DueDateCalculation  = Today  then

    SMPT.Send;

    //Sunday

    duedate := 04/05/2017

    sundaydate := 09/05/2017

    DueDateCalculation := CALCDATE('+5D',duedate );

    Today := 08/05/2017

    if DueDateCalculation  = Today  then

    SMPT.Send;

    //Monday

    duedate := 05/05/2017

    sundaydate := 10/05/2017

    DueDateCalculation := CALCDATE('+5D',duedate );

    Today := 10/05/2017

    Saturday and Monday server will be in on so Saturday Monday working fine but Sunday not working email not sending so that i want send a mail on Sunday also for that only im trying this code

    if due date is greater than 5 days of today  i need to send mail  please tell me now

    Thank you

  • Suggested answer
    Stefano Demiliani Profile Picture
    37,166 Most Valuable Professional on at

    If the NAV server is down, the email cannot be sent.

    If you want to check if the DueDateCalculation occours on Sunday, you can use the Date virtual table:

    https://community.dynamics.com/nav/b/tharangacnavblog/archive/2017/02/02/use-of-virtual-table-date-microsoft-dynamics-nav

  • Community Member Profile Picture
    on at

    Hi,Steafno,

    Thank you for your reply ,i want to send a mail duedate is greater than 5 days of today. how i achive this by code

    duedate := 25/4/2018

    DuedateCalculation := calcdate(>=+5D, duedate)

    TodayDate := TODAY;

    please tell me.

    Thank you

  • Suggested answer
    Stefano Demiliani Profile Picture
    37,166 Most Valuable Professional on at

    The code that works is this:

    DueDateCalculation := CALCDATE('+5D',TODAY); //here you calculate 5 days from today

    IF DueDate  > DueDateCalculation then //If DueDate is greater that 5 days from TODAY

    BEGIN

     //Here you can send your email

    END;

  • Suggested answer
    Amol Salvi Profile Picture
    18,698 on at

    DueDateCalculation := CALCDATE('5D',TODAY)

    If DueDateCalculation > TODAY THEN BEGIN

       your code goes here..

    END;

  • Community Member Profile Picture
    on at

    Hi Stefano,

    I want to send mail duedate expired after 5 days or >5 days mail will go

    duedate := 3/5/2018   after 5 days

    mail date := 8/5/2018

    or

    duedate := 4/05/2018  >5 days

    mail date := 9/05/2018

    this mail date is equal  to today date then mail will go

    if(maildate =duedate) then

    SMTP.Send

    Thank you

  • Olister Rumao Profile Picture
    3,967 on at

    Hi Ashwini.123,

    Considering that you want to send email to entries having DueDate >=5Days from TODAY  then use

    NewDate = CALDATE('5D',TODAY);

    IF DueDate >= NewDate THEN BEGIN

    //Your mailing code

    CLEAR(SMTPMail);

    SMTPMail.CreateMessage('',SMTPMailSetup."User ID",EmailID,'Value','',TRUE); //EmailID is recepient email address and Value is the Subject of the mail

    SMTP.AppendBody(Text009);

    SMTP.AppendBody(Text010);

    SMTP.AppendBody(Text011+' '+COPYSTR(customer."No.",1,50)+','+' '+COPYSTR(customer.Name,1,50)+ ' '+Text012+FORMAT(dueamounts)+Text0017);

    SMTP.AppendBody(Text010);

    SMTP.AppendBody(Text013);

    SMTP.AppendBody(Text014);

    SMTP.AppendBody(Text015);

    SMTP.AddAttachment(path,PdfDocPath);

    SMTP.AddAttachment(path2,pdf2);

    SMTP.Send;

    END;

    If the mail doesn't send please check the SMTP Mail Setup. Try by sending mail without the attachment first.

  • Community Member Profile Picture
    on at

    Hi Olister

    Thank you so much for your reply

    your above code i have tired unfortunately its not working please see my blow screen shot

    dueamount.png

    i want to send a mail after or greater than 5 days of expired due date  not after 5 days of TODAY date.

    Thank you

  • Verified answer
    CDsilva Profile Picture
    4,188 on at

    Hi Ashwini,

    you can try NewDate = CALDATE('5D',DueDate); //this will calculate duedate + 5 days

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans