Whether you’re new to Salesforce or it’s all old hat to you, you’ve probably come up against some requirement where you needed to take information from Salesforce and put it on a PDF, Word Doc, or other document. Whether you use Salesforce Mail Merge, Conga Composer (our App of the Year pick for 2013), or any one of the numerous other solutions on the market, you will come up against issues where the format of the data you have in Salesforce doesn’t match the format you need on your document. Sometimes you can format the data right on the form, but frequently you’re going to need it formatted before it ever leaves Salesforce. No need to give your team a lot of extra work. Just throw a few formula fields in and you’ll be merging faster and cleaner than ever before!
A common requirement is splitting up a date into separate Year, Month, and Day fields. A separate Formula Field for each will take care of this. Here’s how it works:
Create a Text Formula Field called Date Year, choose the date field you’ll be using, and put it in the following formula: TEXT(YEAR(Date_Field))
Now, create another for Month and Day – TEXT(MONTH(Date_Field)) and TEXT(DAY(Date_Field)) respectively.
Another common scenario comes when you want your document to display a client’s Billing Address if the Shipping Address is not available. For this, create a Text Formula Field for each segment of the Address (I’ll show you for Street). Now we’ll use an IF statement to check if the Shipping Street is blank. Here’s how it looks:
IF(ISBLANK(ShippingStreet), BillingStreet, ShippingStreet)
Do the same for City, State, and Zip, and you’re in business.
Remember, when in doubt with mail merges, formulas are your friends! Check this out for more formula ideas to get you going.
-Jared and the Salesforce Guys