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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Automatic birthday mails to contacts using Workflow

(0) ShareShare
ReportReport
Posted on by

Hello Friends,

Please I need to be able to automatically send birthday and anniversary mails to my contacts.Kindly help me on how to go about this.Thanks.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Aiden Kaskela Profile Picture
    19,696 on at

    Hi Felix,

    This is a frequent question and there are a lot of answers, but none of them are very good. CRM doesn't really support scheduled workflows, so all the answers out there use some hackey self-referencing workflow or kick it off using a bulk delete job, which can be scheduled. The self referencing workflow is fragile because if one fails there's nothing to kick off the next one.

    What you'd need to do is set up a workflow like this:

    Step 1: If Next Birthday is null, set a field for Next Birthday. That would be the next time the workflow runs.

    Step 2: Wait until workflow execution time > Next Birthday. This puts the workflow to sleep until the anniversary date.

    Step 3: Set Next Birthday to Next Birthday + 1 year

    Step 4: Send the email

    Step 5: Start a new Workflow (this one).

    Now your workflow will be asleep until next year and then kick off again. Like I said, it's pretty hackey. You'll also need one instance per contact, so that could get to be a really high number as well.

    This is how the CRM team suggested it on this blog. That post is eight years old and there's still not a better way to do it, in CRM.

    blogs.msdn.microsoft.com/.../part-1-happy-birthday-via-workflow-using-client-side-scripting

    The way I prefer doing it is using a scheduled process outside of CRM and sending the emails through code. It's more work to set up but it's much more reliable than workflow.

    Hope this helps! I'd appreciate if you'd mark this as Answering your question.

    Thanks,

     Aiden

  • Community Member Profile Picture
    on at

    Thanks Aiden,

    I followed the link in your response but got the error message below while selecting the birthday date on my new contact.

    mail.PNG

    Script Error

    One of the scripts for this record has caused an error. For more details, download the log file.
    ReferenceError: birthday is not defined at eval (eval at RunHandlerInternal (lotusbetaanalytics.crm4.dynamics.com/.../ClientApiWrapper.aspx), <anonymous>:1:1)

    Thanks.

  • Suggested answer
    Nithya Gopinath Profile Picture
    17,078 on at
  • Suggested answer
    Community Member Profile Picture
    on at

    Please convert the script to crm 2015 version. the script in above link is compatible for crm 4.0.

    var birthdate = Xrm.Page.getAttribute("birthdate").getValue();
    
    if (birthdate == null)
    
    {
    
    Xrm.Page.getAttribute("new_upcomingbirthday").getValue()= null;
    
    return;
    
    }
    
    var today = new Date();
    
    today.setHours(0);
    
    today.setMinutes(0);
    
    today.setSeconds(0);
    
    birthdate.setFullYear(today.getFullYear());
    
    Xrm.Page.getAttribute("new_upcomingbirthday").setValue(birthdate);


  • Community Member Profile Picture
    on at

    Hello Ahktar,

    Thanks for the post.

    I was prompted to fill the function field in the screen shot shown below . Anything I fill in comes out as an error on my contact form. Please,what do you advice.

    crm-error-scrip.PNG

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

News and Announcements

Season of Giving Solutions is Here!

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 CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans