Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

Check to send mail NAV

Posted on by Microsoft Employee

Hello world,

i want to create a CodeUnit to check 2 fields (Date) if they are empty, dont do anything, if not add 30Days and check if its >= the previous Field. after comparing send a mail message

Thanks for helping me

*This post is locked for comments

  • Suggested answer
    CDsilva Profile Picture
    CDsilva 4,184 on at
    RE: Check to send mail NAV

    Hi

    You can refer my blog, in the blog the code checks for the visa expiry date, if visa expires in a month then a  email is send to the HR. you can code on similar lines

    http://www.cloudfronts.com/run-batch-check-visa-expiry-date-employees-send-email-visa-expires-month-dynamics-nav/

  • 4BzSoftware Profile Picture
    4BzSoftware 6,071 on at
    RE: Check to send mail NAV

    You're welcome!

    Have a nice day to all :-)

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Check to send mail NAV

    Thank you so much Khoa Nguyen

    I appreciate that

  • Suggested answer
    Mohana Yadav Profile Picture
    Mohana Yadav 59,139 Super User 2024 Season 2 on at
    RE: Check to send mail NAV

    Always use FINDSET for REPEAT UNTIL

  • Suggested answer
    4BzSoftware Profile Picture
    4BzSoftware 6,071 on at
    RE: Check to send mail NAV

    Hi Zakariia Bou,

    It is same as a request from my customers. If Date of Expiry of one of two passports is going to be expired within 30 days, send an email to HR Staff to notify them.

    LOCAL CheckSendToMail()

    IF (Employee.FINDFIRST) THEN

      REPEAT

        IF (Employee."Echéance Passeport 1" IN [TODAY..CALCDATE('<+30D>', TODAY)]) THEN

          SMTPMail.Send

        ELSE IF (Employee."Echéance Passeport 2" IN [TODAY..CALCDATE('<+30D>', TODAY)]) THEN

          SMTPMail.Send;

      UNTIL (Employee.NEXT = 0);

  • Suggested answer
    Mohana Yadav Profile Picture
    Mohana Yadav 59,139 Super User 2024 Season 2 on at
    RE: Check to send mail NAV

    check this link about CALCDATE

    msdn.microsoft.com/.../dd301368(v=nav.90).aspx

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Check to send mail NAV

    i created a Function (CheckToSendMail) and i put this :

    LOCAL CheckSendToMail()

    Employee.FINDFIRST;

    REPEAT

     IF

       Employee."Echéance Passeport 1" <= CALCDATE('<TODAY+30D-1>')

       THEN EXIT

       ELSE

       SMTPMail.Send ;

     IF

       Employee."Echéance Passeport 2" <= CALCDATE('<today+30D>')

       THEN EXIT

       ELSE

       SMTPMail.Send;

    UNTIL Employee.NEXT =0;

  • Suggested answer
    Mohana Yadav Profile Picture
    Mohana Yadav 59,139 Super User 2024 Season 2 on at
    RE: Check to send mail NAV

    Did you try anything? Please provide what did you try and what issues are you facing.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Check to send mail NAV

    thank you for responding.

    my question is , how can i do that ??

  • Suggested answer
    Mohana Yadav Profile Picture
    Mohana Yadav 59,139 Super User 2024 Season 2 on at
    RE: Check to send mail NAV

    what is your question now?

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans