It is not uncommon to create business processes based on interpreting sets of data inside salesforce.com such as:
- Assignment rules
- Lead/Contact Scores
- Workflow rules
- Apex code
Formulas can help simplify the management of complex business processes where criteria may change over time. Some advantages to using them are:
- Formulas contain criteria in one location in a format supportable to most system administrators.
- It’s often easier to read a formula instead of 20 assignment rules.
- You can contain logic in a formula that might otherwise be in Apex code, making criteria changes simple without needing to change your code.
- The same formula may be able to be leveraged by multiple business processes, such as, a region formula.
Here are some of the formulas we’ve used successfully at Full Circle CRM in the past:
Junk Lead Formula (On the Lead Record Used for Lead Assignment Rules)
Create a formula that looks at the criteria you consider to indicate that a Lead contains bad data (for example First Name starts with 1,2,3,4,5,6,7,8,9,0). I like this formula to evaluate to 1 if it’s junk, else 0 – but you can use a text string as well. Then the assignment rule can simply evaluate if the field = 1 assign to a Junk Lead Queue. Depending on how much criteria you have you may need several fields to support comprehensive spam filters – but it’s better than 10 lead assignment rules.
Another nice one for simplification of lead assignment rules is the region or territory formula – often subject to change and easier to manage in a formula than in the multiple assignment rules (yes we’ve used this to bring hundreds of assignment rules down to a manageable number in large organizations).
Assignment Time-Out Formula
In a recent best practice blog entry we talked about the benefits of utilizing Sales Time-Outs. When setting a time-out based on a disqualification reason, often a Lead/Contact status dependent picklist field, you can create a series of workflows for each variation of the number of days that need to be set on a time-out field.
Alternatively you can create a formula on the Lead or Contact that evaluates to a number based on the disqualification reason. The number represents days, and a single workflow can have one field update using a formula: Today() + FieldName__c. When you add a new disqualification reason or decide to change the date range, simply update the formula field – no need to update the Workflows.
In cases where you are looking at demographic data on Leads or Contacts to set a demographic qualification score, a formula may be a useful approach rather than evaluating all of the fields in the context of assignments or other business processes.
In cases where Apex code needs to evaluate data on a record and on related records you can often create a formula that is evaluated by the code rather than having the code evaluate all of the fields directly. This lets you easily modify the data and criteria that is being evaluated without having to modify the code.
Report Enhancing Formulas
For reporting it’s often nice to create a formula that outputs a result so that reporting is easy. For example the display would be problematic on a report tracking SLA attainment on a record if you have different data points and complex criteria to evaluate because there is no natural grouping for SLA outcomes. This may require different reports for each outcome.
How about a formula that outputs the text result so that you can group by this value and take the filters out of the report? For example a custom formula field called SLA Outcome can evaluate to ‘Attained’, ‘Expired’, ‘In Process’, and for good measure add ‘N/A’ for those records not subject to SLAs.
If you have cool formula tricks you like to leverage – feel free to comment here or direct us to your favorite reference.