This project is read-only.
Example Birthday Fix Workflow
The following is an example CRM Workflow that shows off the power of the SonomaPartners.DateTimeUtilities. The goal of the workflow is to workaround the native Time Zone issue when storing Date fields in CRM.

If you use a Date only field such as Birthdate, CRM will store the time as midnight in the user's local time zone. The issue with this is that, for example, if a user who updates the Birthdate field is in Central time zone then a user in Mountain time zone views the Birthdate, it will be one day earlier. This is because the Date/Time field is stored as midnight Central time which is 11 PM Mountain time the day before.

With the SonomaPartners.DateTimeUtilities, we can work around the time zone issue with a workflow using four simple steps.

1) First add a step for GetDateParts passing the Birthdate field into the custom activity.

2) Next use a Check Condition on the result of the GetDateParts custom activity. We want to check if the "Hour" is NOT set to 12. This way the Birthdate will not be updated multiple times if the Hour is already set to Noon.

3) Add a step for a successful Check Condition from step 1. This step will call SetDateParts passing in the Birthdate field and also with the "Hour" argument set to 12. This will overwrite the Midnight Date/Time field and set it to Noon.

Note: The default value of each argument is -2147483648 (the minimum value of an integer), therefore if you update the arguments, you will see each null value set to -2147483648 which is intended.


4) Lastly, add a native workflow step to Update the Contact record setting the Birthdate field to the result of the SetDateParts activity. This will set the Birthdate to Noon which gives some buffer so that users in other time zones will still see the same Date rather than the day before or the day after.

Other Examples
The utilities can be helpful for having a workflow wait til a more specific Date/Time. For example, you could have a workflow execute a process at 2 AM the day after a record is created. This can be done is three simple steps as well.
  1. Pass the Created On into the AddDateParts with the "Day" argument set to 1. This will add 1 day to the Created On Date/Time and return the result.
  2. Pass the result of the AddDateParts activity into a SetDateParts activity with the "Hour" argument set to 2. This will set the Hour to 2 AM.
  3. Lastly, make a Wait step and set the Date/Time to the result of the AddDateParts activity (which is now set to 2 AM the day after the original Created On)

Last edited Jul 24, 2012 at 3:27 PM by bscarlavai, version 10


nathanmarshall Feb 19, 2015 at 5:04 PM 
Great little plugin, thanks for creating and sharing this!

For those who don't know how to install... download the relevant .dll file and use the plugin registration tool in the SDK to register the plugin.

Helpful link:


claytonsmith Feb 16, 2015 at 9:53 PM 
Any chnace of adding a calculation for Week Number ie 1-52? Otherwise a great little tool

Nicole_CRM Oct 28, 2014 at 6:10 PM 
Can someone please provide installation instructions for this utility?

UlrichFaden Aug 21, 2014 at 4:03 PM 
Hi Sonoma Team,
thanks for this practical tool set!
I try to calculate a new start date from a subscription, where i have to add X months to the current start date. When i do this with your tool it adds e. g. for 3 months 90 days and not full 3 months so he calculates e. g. 30.11. instead of 1.12. Any idea how to solve this?
Thanks in advance, Uli

seeenu007 Dec 19, 2012 at 12:36 PM 
Could any one tell how to use this? This utility should be registered with Plugin? If yes what are the steps to be added?

bryce2071 Nov 9, 2012 at 3:57 PM 
how to install?