Users want to have consistency when they view records and what content will appear in them. It’s also important that you don’t have records that are all named the same thing, otherwise that would defeat the purpose of searching. Imagine, what if you had 10 people named Jim in a room. What you’d do is probably start calling them by something else, either Jim + their last initial or even by their last name. This makes it easier to discern who is being talked about. The same applies to records in salesforce. By adding more discerning characteristics to a record, it’s possible to more easily find the record being referenced. This is also really important in dashboards, if you decide to group by name for your table components.
In order to provide some automation around naming records, we can do so by using workflow rules.
For sales users!
In order to consistently name opportunities, the format I’ve come up with is Account Name + PRIORVALUE(Name) + YYYYQ#. This ensures that sales reps consistently have the save naming schema. For the naming scheme, we’re also requesting that the name be updated each time the opportunity close date is modified. In order to accomplish this goal, a fairly complex formula is needed.
Step One:
Create a workflow rule that is set to fire every time the opportunity is created or edited. Why? We will need to use the ISCHANGED function to be able to reevaluate if the close date has been modified.
For the rule criteria, enter the following:
(CONTAINS(Name, MID(Name, /* Find -YYYYQ# in Opp Name */ FIND("-" + TEXT(YEAR(PRIORVALUE(CloseDate)))+ "Q" + TEXT(CEILING(MONTH(PRIORVALUE(CloseDate))/3)), Name), /* Get the 7 characters for the mid function and see if they match */ 7)) /* And make sure the closedate value is changed */ && ISCHANGED(CloseDate)) /* If it is new, the opp will automatically be named */ || ISNEW()
This formula does the following:
- Finds the prior value of the close date in -YYYYQ# in the name.
- Checks to see if the name contains the previous close date in format -YYYYQ#.
- Check to see that the close date has changed.
- Evaluate to true if the record is new.
Pro tip:
You can use comments in your workflow and validation rules by starting with /* and ending with */. This helps others understand what’s being done and the intent behind the workflow or validation.
Step Two:
Use the following for the formula:
IF(ISNEW(), /* If the opportunity is new, use the format AccountName-PriorValueName-YYYYQ# */ Account.Name + "-" + PRIORVALUE(Name)+ "-" + TEXT(YEAR(CloseDate))+ "Q" + TEXT(CEILING(MONTH(CloseDate)/3)) , /* If the opp isn't new and matches entry criteria, replace the year with the new close date & change the quarter */ SUBSTITUTE(Name, /* Find the pattern of YYYYQ# and get the 6 characters for replacement */ MID(Name, FIND( TEXT(YEAR(PRIORVALUE(CloseDate)))+ "Q" + TEXT(CEILING(MONTH(PRIORVALUE(CloseDate))/3)), Name), 6), /* Change out the values */ TEXT(YEAR(CloseDate)) + "Q" + TEXT(CEILING(MONTH(CloseDate)/3))) )
This formula does the following:
- If the opportunity is new, format it correctly.
- If it isn’t new, change out the year and quarter based on the closed date.
The end result:
One caveat: this does not override the field populated in the lead convert page, and therefore, you may want to create a button hack so that users to not get confused.
For marketers!
Step One:
Create a workflow rule that has the criteria that is always set to “True” for when a record is created. The other option is to create a checkbox on the campaign layout called “Do Not Override Name.” The workflow can be set to not evaluate when checked. This is useful for parent campaigns, but its usage will depend on current business processes.
Step Two:
Use the following workflow rule to set the campaign name with the prior value + a shortened string for the type and YYYYQ#.
/* Set name to previous name */ PRIORVALUE(Name) + "-" + /* Assign variable character string based on campaign type */ CASE( Type, "Conference", "CONF", "Webinar", "WEB", "Trade Show", "TS", "Advertisement", "AD", "Banner Ads", "BANNER", "Direct Mail", "DM", "Email", "EM", "OTH") + "-" + /* Add Year and Quarter to the end of the string */ TEXT(YEAR(Today())) + "Q" + TEXT( CEILING(MONTH(DATEVALUE(CreatedDate))/3)
The end result:
By naming things consistently it will allow for more consistency in your reports, your dashboards and search. It will also help users find relevant records and not to mention they will spend less time entering data. I think that’s a win that everyone can agree to!