Changing the way Salesforce Admins and Developers think about client solutions.

Category: Custom Code

Restaurants Part 2, Spring ’15, and some Custom Code

You know what I hate about restaurant aggregator sites?  This:Restaurants

Seriously.  Out of all those places, probably 5-10 are a place I would take my wife.  This is really the best they can do?

Continue reading

It’s Christmas Time!


Which means time for gifts.  You know what drives me nuts?  Lots of things but here are two of them related specifically to Christmas

  1. Remembering all my great gift ideas for myself that I thought of throughout the year
  2. Finding the emails that the rest of my family sent months ago with their own gift requests

Continue reading

Rant #1 – Cross Filters

Please read this, if you never read anything else I write, and you don’t know about Cross-Filters.  I guarantee you’ll make the time back the first time you use them.



Ever wanted to quickly pull Accounts that don’t have Contacts, or Accounts that don’t have Opportunities, or Accounts that don’t have Activities?  Maybe you wanted to pull all three of these at once?  Or in the case above, people with male torsos who are not centaurs?  Something like this:



Continue reading

Birthdays – Managing in Salesforce

This is a continuation of my first post on Birthdays in Salesforce


I’m going to preface this by saying that I’m well aware that the majority of people already track birthdays in their own personal or work calendar, what I’m trying to do is leverage what can be done in Salesforce to show off some of the automation capabilities, and also show how you can solve a problem that I’ve been asked many times over the years by end users.

So why do something in Salesforce you already have elsewhere.  Well there are a few reasons:

  1. I can set the automation rule to apply to all contacts.  I know that when I save them in Gmail I have to set the reminders for each birthday I put in the system.  This is a set and forget approach.  Even better for people with more friends than me
  2. I can have different automation rules, not just reminders where I set the hours in advance where I get reminded
  3. Because with Salesforce1 I can quickly view and add them while on the go

First off, here is a contact record for Kelso Flynn.  He’s my dog, and this isn’t really his birthday.


You’ll see that there is a standard birthday field on the contact page that is in the format of DD/MM/YYYY.  What I want to do in this blog is try and solve a few problems:

1. You’ll notice there is a year value in the field.  We need to change this because birthdays have a habit of happening every year, and typically most people also like people to recognize their birthdays on a yearly basis, not just the first time.

2. I’m personally terrible at remembering these things.  I can get a calendar reminder a few times at least, and I’ll still forget to call.  What I want to do here is get the message back to me a few ways, hoping that one of them will stick.

1st Step – A workflow rule

Setup > Create > Workflow Rules and Approvals > Workflow Rules


Some people prefer to create workflow actions first, nothing wrong with that, I just prefer to create the rule to trigger the actions first, but either way is fine.  In this case, we need to use Time-based triggers so there are two things I need:

  1. Evaluation Criteria:  Created and any time it’s edited to subsequently meet critieria.  I don’t use just created unless business requirements absolutely call for it, and we can’t run the workflow every time it’s edited if we want to use Time based workflows.
  2. Rule Criteria: Basic for now, just if they have a birthday populated.  Later on we’ll probably also filter this for record type as we build out the org.  It’s important to always go back when you add items like record types and verify what existing behaviours need to be adjusted.


I’m going to use 3 Time Triggers for this, all with different actions:

  1. 7 Days out I want a task
  2. Day of I want an email
  3. Day after I need to change the birthday to the following year

Note: Make sure you set up all your triggers, and add actions, prior to Activation.

2nd Step – Telling the Workflow Rule what to do

Assign a Task:

Setup > Create > Workflow Rules and Approvals > Tasks

For this I’m creating the task 7 days in advance, but I’m only setting the due date for 3 days prior to the birthday.  This way I have it in my upcoming activities for a few days to give me time to get the gift – ideally.  I’ll still forget

Send an Email:

Setup > Create > Workflow Rules and Approvals > Email Alerts

This is a two-parter where I’m creating the rule, but I also need to create a template in Setup > Communication Templates > Email Templates

The rule is basically who it goes to, what object it’s being used for, and what template is being used.

My template is pretty basic, the key is to remember to make it Available for Use

Subject: Birthday Warning


Hey Buddy,

Just an FYI in case you forgot that {!Contact.FirstName}’s bithday is today and you probably want to call them.

Here’s the direct link to the record just in case you also want to check gift ideas

Two things here:

1. {!Contact.FirstName} is a merge field so it will always pull the Contact that it is being sent on behalf of – Kelso in this case

2. Gift Ideas is a later blog entry, I’m just building suspense.

Change the Birthday:

This to me is the key to getting it to work in Salesforce and something that can stump a new Admin.  What I need to do is actually change the birthday on a yearly basis through a field update: Setup > Create > Workflow Rules and Approvals > Field Updates

Your choices for a field update will depend on what kind of field you are updating.  In this case, since it is a date field, we can either erase the field value, or use a formula to set a new one.  Erasing the value is common in cases where the user wants a one-time reminder.

In our case, we need to take the current birthday and using Salesforce formulas, move it a year forward.  The formula is pretty basic:

What we are doing here is saying that we are creating a date using the DATE formula, by taking the YEAR, MONTH, and DAY of the existing Birthday, and putting it all back together again after adding 1 to the year field.

The key with this whole workflow, is that you need to click the Re-Evaluate Workflow Rules after Field Change field, in order to refire this workflow for the following year


Putting it all together

We have now created a automation process within Salesforce that:

  1. Activates whenever I add a birthday to a contact in Salesforce
  2. Sends a task to me 7 days prior to their birthday, with a due date 3 days prior to the day
  3. Sends an email to me on the day of the birthday reminding me that I may have dropped the ball and really need to get on top of this
  4. Changes the birthday to the following year and reactivates the process again to get ready to do it all over again

Now all you have to do is Activate your rule – workflow rules don’t activate themselves!

Note: Time Based Workflow Rules generally fire at midnight based on GMT.  If you want something the day of – such as the email in this case, I find it helpful to use the hours after instead of days after=0 in order to get it to fire at a certain time.

The next post will be on monitoring and viewing upcoming birthdays, along with how it would look on Salesforce1 as well

© 2018 ExploitedDevOrgs

Theme by Anders NorenUp ↑