Thursday, 14 May 2015

Zoho CRM Birthday and Anniversary Auto Emails

I have read a number of frustrated posts about trying to do a simple thing like send an email out to a customer on their birthday or anniversary etc. I have spent quite some time on this and am pleased to say it works perfectly. First issue is you must use Enterprise Edition to allow the triggers to send out the email on the birthday to your contact.


Zoho CRM Birthdays





The approach I took was as follows:
  • use the Date of Birth field on the contact record of CRM
  • created a new field called "Next Birthday"
  • as an option, I also calculated the Age of the contact so created a field called "Current Age".(this may be important if you wish to market different products based on age to the contact)

To make this all work you DO NOT use Formula fields. You must use Custom Functions. These can be found under Set Up | Workflow | Custom Functions.You will need 3 customer functions. The reason being, once you create the record the first time the Next Birthday and Age can be calculated as part of the Create Record triggers however what happens next year? How is the system going to move the Next Birthday date forward one year once the current year's birthday passes? How will the age automatically click over one more year? So while you can make some of this happen by editing a record you cannot do this for thousands of records in the database. So using the Date condition trigger in the workflow, you can run the update checker each night to refresh the age and next birthday of a contact either one day after their Next Birthday or on the actual day of their birthday.

Not sure you are following me so far?

Given we have the Next Birthday Date calculating correctly and updating once a year, then an email can be automatically send out when the NEXT BIRTHDAY = TODAY. 

So as discussed, I needed to write 3 Custom Functions and link these to 4 different Workflows prior to the final workflow which was the Email Alert / Template. Which was the easy part.

The following are the Custom Functions Built;

  • Create calculate "Next Birthday from DOB" -  used when record first created. Simply work out the number of years since the DOB and add that back to the DOB and you get this year's birthday.
  • Update Next Birthday Year to Year - for this I just checked if the Next Birthday was yesterday, and if it was I added one year to the date. So this would run each night. 
  • Update the Age. Same concept, just check the Next Birthday. It is a little tricky. You need to get the comparison to the date right as someone can be in their 30th year but not yet 30 because the birthday is still in the future. So age is still 29 until the Next Birthday has passed. Then you update the age. This would be triggered on the actual birthday where as Next Birthday update can happen the day after (e.g. Next Birthday + 1).

Once these Custom Functions are created I used 4 workflows to trigger their execution.

  • First Workflow Trigger was an event based trigger on new Contact Creation, if the DOB was entered then execute Custom Function 1. Calculate Next Birthday.
  • Copy this workflow and use it to also calculate the Age on first time record creation. Just replace the Custom Function 1 with Custom Function 2. A single workflow could be used but I like having them separate so I can better manage each process.
  • Next workflow is Time based and it would be triggered on NEXT BIRTHDAY = Today - 1. This means the birthday was yesterday. On this basis run the Next Birthday updater (Custom Function 3). This will push the year forward one year. So if today was 3-Mar-2015, all Next Birthday fields that were 2-Mar-2015 would become 2-Mar-2016. You would set a time this rule would execute so say 3am. So in the morning all records are now updated.
  • Last workflow is also Time based, when NEXT BIRTHDAY = today, then run the Age Update function. As your age increases on your birthday not the day after. Use Customer Function 2 again and just ask it to recalculate things so you should get a bigger number. Once again, kick this off at 2:00am and then in the morning the ages will be right for all contacts.

As discussed above, the Email Template for the HAPPY BIRTHDAY message, would be connected to a Workflow Alert with the Contact being nominated as the receiving party of the email. (you can select a number of email addresses to send this to if required). You create the Final Workflow, to trigger when Next Birthday = today, and you associate the Alert created to this trigger. Lock it, then you are good to go. Sit back and the automation will start.

This does all work. There is a little involved I am sure you realise. Our consultancy is offered to those who would like assistance in this area.

2 comments:

  1. This is excellent! Thank you very much!

    Do you think it would also be feasible to create a workflow trigger for only specified birthdays? For example 59th birthday or 64th?

    Jesse

    ReplyDelete
  2. Yes of course. We would also calculate the age each year and based on that a rule can be triggered. With Zoho CRM you can only send an email to the client if you have Enterprise edition. If you use Professional the email can only be sent internally.

    ReplyDelete