Next Birthday Formula
How would you display your Contacts with upcoming birthdays? I’ve seen people use “Birthdays This Week,” “Birthdays This and Next Week,” and other reports to display the list.
I’ve also seen requirements for showing a person’s next birthday, to trigger an automatic email to each Contact on his/her birthday. Let’s see how it’s done:
if(
Month (Birthdate) < = Month(Datevalue( NOW() ) ),
if ( Month (Birthdate) < Month(Datevalue( NOW() ) ),
DATE( YEAR( DATEVALUE( NOW() ) ) + 1 , MONTH( Birthdate ) , DAY( Birthdate ) ),
if ( Day (Birthdate) < Day ( Datevalue ( NOW() ) ),
DATE( YEAR( DATEVALUE( NOW() ) ) + 1 , MONTH( Birthdate ) , DAY( Birthdate ) ),
DATE( YEAR( DATEVALUE( NOW() ) ) , MONTH( Birthdate ) , DAY( Birthdate ) )
)
),
DATE( YEAR( DATEVALUE( NOW() ) ) , MONTH( Birthdate ) , DAY( Birthdate ) )
)
Next, use Batch Apex to send an email daily to all people where Next_Birthday__c == date.today(). Easy!
Now we can put this into a report and a dashboard showing the next “n” birthdays. Sure, it’s possible that more than n people will have a birthday on a given day, but at least you know that the emails will go out to each of them! If you want to see everyone with birthdays in a certain range, make a custom report and click through from a dashboard or a custom link.
Enjoy!
Computer Associates Plans To Release Agile Development Tool On Force.com Platform
Today, at Dreamforce 2009, Computer Associates plans to release CA Agile Planner(http://www.ca.com/agile), a tool to manage agile development teams.
CA Agile Planner will be integrated with CA Clarity PPM (http://www.ca.com/ppm).
Although it was not clear how much of the demonstrated app will run on Force.com and how much will run on the CA servers (though it appeared to be 100% on Force.com), it was clear that the application was accessed via a force.com URL.
For more information, see http://www.ca.com/agile.
A release date for the product was not mentioned, but the earliest planned release of any newly-announced feature thus far is Spring 2010, so one might assume that this will not be available until then.
New Developer Library Released
Filed under: Apex, Development, Force.com Platform, New Features, salesforce.com, Visualforce, Winter 10
Today, Developer Force (http://developer.force.com) released its new library. Here are a few of them. All can be found at http://wiki.developerforce.com/index.php/Documentation.
Workbook
http://www.salesforce.com/us/developer/docs/workbook/index.htm
Fundamentals
http://www.salesforce.com/us/developer/docs/fundamentals/index.htm
Cookbook
http://www.salesforce.com/us/developer/docs/cookbook/index.htm
Apex Advanced Code Example
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_shopping_cart_example.htm
https://sites.secure.force.com/appexchange/listingDetail?listingId=a0N30000001saDCEAY
And many more to come!
Trigger to help Salesforce for Twitter
Salesforce for Twitter is one of the best AppExchange packages I've seen. It fulfills the promise salesforce.com made to bring the Service Cloud to all orgs of all sizes. And it works well.
Though a supplemental/unofficial guide to customizing SFDC for Twitter will be released soon on this site, I wanted to share a trigger I just wrote to add new Leads to a campaign:
Firstly, thank you to Scott Hemmeter at Arrowpointe, who wrote the original code that I customized.
Secondly, you could easily duplicate this trigger and set it to run on the Contact object as well.
Please don't set the trigger to "after update," as in testing, it ran into problems when converting a Lead and merging with a Contact already on the "Twitter" campaign.
trigger AddToTwitterCampaign on Lead (after insert) {
// List containing each Lead being processed
list<Lead> theLeads = new list<Lead>();
//We only execute if we have a campaign named "Twitter"
if([SELECT Count() FROM Campaign WHERE name = 'Twitter'] == 1){
Campaign TC = [SELECT id, name FROM Campaign WHERE name = 'Twitter' LIMIT 1];
for(Lead l:trigger.new) {
if (l.leadsource.indexOf('Twitter',0 ) >= 0 || l.leadsource.indexOf('Tweet',0 ) >= 0 ){
theLeads.add(l); // add lead to the main lead list
}
}
// List containing Campaign Member records to be inserted
list <CampaignMember> theCampaignMembers = new list<CampaignMember>();
for (Lead ld:theLeads) {
CampaignMember cml = new CampaignMember();
cml.leadid = ld.id;
cml.campaignid = TC.id;
theCampaignMembers.add(cml);
}
//Insert the list of Campaign Members
if(!theCampaignMembers.isEmpty()){
insert theCampaignMembers;
}
}
}
The trigger requires that you have a Campaign called "Twitter," but feel free to change that to anything else you'd like.
Don't worry if you have other triggers that add Leads to Campaigns - this can work alongside them, so you can add Leads to as many Campaigns as you'd like.





