Print this page

How can I keep a consistent naming convention in my records using a workflow field update?

Knowledge Article Number 000214443
Description This article will guide you through the creation of a workflow rule and a field update that will help you to keep a consistent naming convention across all records based on a variable field.

You can amend the example below to different Objects and Fields to any other example that suits your business needs, we will provide guidelines on how to do that and best practices for the scenario. For demonstration purposes in this example we will use the following parameters:

Example Use Case: In our environment we use multiple currencies. We want our reps to always have the Currency displayed every time as part of the Opportunity Name so they can't miss the Currency they're currently working no matter where they are (e.g. the related Account details page, adding Opportunity Products...).
Object: Opportunities 
Variable Field: Opportunity Currency (CurrencyIsoCode)
Target Field: Opportunity Name
Naming Convention: [CurrencyIsoCode] - Opportunity Name

Please note: In this example we are using square brackets [] as characters to identify and update the Name of the record. If your users are already using square brackets to tag records (e.g. [URGENT]...) you will need to amend the formula given below and define a different character for your naming convention. 
Failing to replace the character in the formula, in this example, would result on the field update overriding from "[URGENT] - Opportunity Name" to "[EUR] - Opportunity Name".
Resolution We would need to create a Workflow Rule to evaluate all Opportunity names based on the formula you specify. We need to create a Field Update to make sure the format is consistent to the convention we defined above.

First we'll create the Workflow Rule.

1. Click Setup | Create | Workflow & Approvals | Workflow Rules.
2. Click "New Rule" button.
3. Select the Opportunity object. Click "Next".
4. Enter the Name and Description. Select "Evaluate the rule when a record is created, and every time it’s edited" as evaluation criteria.
5. Under Rule Criteria select "Run this rule if the following" and choose formula evaluates to true.
6. In this example we want to evaluate every change so simply add "TRUE" to the formula field.
Note: If you have certain records that don't need to follow the naming convention please amend the rule criteria so it matches your needs.
7. Click "Save & Next".

Now we will define an immediate workflow Field Update to make the necessary changes to the Opportunity Name.

1. Click "Add Workflow Action" and select the "New Field Update" option.
2. Enter the Name and Description. Select "Opportunity Name" in the "Field to Update" option.
3. Under Text Options select "Use a formula to set the new value" and specify the following formula:
/* new records */ "[" + TEXT( CurrencyIsoCode ) + "] - " + Name,

/* existing records */ 
IF(FIND("] - ",Name) > 0,
/* found closing square bracket mark */ "[" + TEXT(CurrencyIsoCode) + "]" + RIGHT(Name,LEN(Name)-FIND("] - ",Name)),
/* did not find mark */ "[" + TEXT(CurrencyIsoCode) + "] - " + RIGHT(Name,LEN(Name)-FIND("] - ",Name))

4. Click "Save".

Finally, please return to the Workflow Rule detail page and click "Activate" to activate the rule.

- This solution requires Workflow Rules. If you do not have that functionality in your Edition please contact your Account Executive for additional details.
Workflow is available in: Enterprise, Performance, Unlimited, Developer, and Editions, and for an additional cost in: Professional Edition

- Before setting up this in Production we would recommend you to use a Sandbox and test it. This way you can make sure that this formula is aligned with your business needs.
- Before pushing this change to Production make sure your users are aware of the functionality. This way you'll avoid confusion and make sure your users are comfortable with the defined standards.
- If your users are already using square brackets to tag records please amend the formula displayed above and replace the brackets with another special character to make sure no undesired overrides occur for your users.
- This formula accounts for the following scenarios:
a) If the record is new, we will make sure the Currency Code is added to the Opportunity Name.
b) If the record already exists but was created before this Field Update was in place we will update it as soon as the record is modified.
c) If the Currency ISO Code changes in the Opportunity the naming convention will be updated, too. It'll replace the old value and make sure the new value is reflected.
- This formula can be amended to other Objects and Fields, for example:
a) Leads - Lead Name being updated to display always the most current Lead Status.
b) Contacts - Contact Name being updated to include a key contact detail, e.g. Phone Number.
You'll just need to modify the formula replacing the fields and build your own solution based on your needs - the options are endless.

promote demote