Ayoub Naming Convention For Flows
Flows can get complex
You could go from building a simple button to send an email, to communicating with another system, to building a massive Intake Form.
You always need to think about the future Salesforce Admin. After you complete this amazing flow, someone else in the future will need to open it to fix a bug or add functionality. When you (I mean, when that person) opens that flow after a year or two, they need to understand what goes where.
Similar to spaghetti code, there are spaghetti flows. If you don't know what I am talking about, you must be using Auto-Layout :)
I personally follow the following naming convention for flows:
(This is just my way, you don't have to agree with it, but I am telling you, it saves lives.)
I will share my reasons and why this way of naming is awesome at the end!
Resources
Variables
Variable | Template | Single or Collection | Example 1 | Example 2 |
---|---|---|---|---|
Text | TxtVar_SomeKeyword | Single | TxtVar_AccountName | TxtVar_FirstName |
Text | TxtVar_GroupingName_Keyword | Single | TxtVar_OppRecordTypeId_Donation | TxtVar_OppRecordTypeId_MajorGift |
Text | TxtColVar_Keyword | Collection | TxtColVar_AccountNames | TxtColVar_OpportunityIds |
Record | RecVar_KeywordIsKeyword | Single | RecVar_Account | RecVar_Opportunity |
Record | RecColVar_Keywords | Collection | RecColVar_Accounts | RecColVar_Opportunities |
Number | NumVar_NumberOfKeyword | Single | NumVar_NumberOfEmployees | NumVar_NumberOfDonations |
Number | NumColVar_Keyword | Collection | NumColVar_NumberOfEmployeesPerCompany | |
Currency | CurrVar_Keyword | Single | CurrVar_OpportunityAmount | |
Currency | CurrColVar_Keyword | Collection | CurrColVar_OpportunityAmounts | |
Boolean | BolVar_KeywordIsKeyword | Single | BolVar_AccountIsAddedToCollection | BolVar_IsNew |
Boolean | BolColVar_Keyword | Collection | BolColVar_CultivationChecks |
You get the idea for the rest of the data types
Constants
Template | Example |
---|---|
Const_SomeKeyword | Const_PricePerBook |
It is even better to have this set outside of flows in a custom metadata or custom settings to allow editing this value without editing the flow itself
Formulas
Return Data Type | Template | Example |
---|---|---|
Text | fx_txt_Keywords | fx_txt_AutomatedOpportunityName |
Number | fx_num_Keywords | fx_num_UpdatedNumberOfEmployees |
Currency | fx_curr_Keywords | fx_curr_NewOpportunityAmount |
Boolean | fx_bol_Keywords | fx_bol_IsMajorGift |
Date | fx_date_Keywords | fx_date_NextYear |
Date/Time | fx_dateTime_Keywords | fx_dateTime_SameTimeTomorrow |
Text Template
Template | Example |
---|---|
TxtTmp_Keywords | TxtTmp_EmailBody |
Choice
Template | Example |
---|---|
Choice_Keyword | Choice_Yes |
Collection Choice Set
Template | Example |
---|---|
CCS_Keyword | CCS_Categories |
Record Choice Set
Template | Example |
---|---|
RCS_Keyword | RCS_Accounts |
Picklist Choice Set
Template | Example |
---|---|
PCS_Keyword | PCS_OpportunityStages |
Stage
Template | Example 1 | Example 2 |
---|---|---|
Stage(Number)_Keyword | Stage1_GettingToKnowYou | Stage2_EducationHistory |
Elements
Screen and Screen Components
Type | Template | Example |
---|---|---|
Screen | Keyword Screen | Contact Information Screen |
Display Text | DispTxt_Keyword | DispTxt_Instructions |
Datatable | Datatable_Keyword | Datatable_Accounts |
For other screen components, I just name them without a prefix
Example Text Input: What is your First Name?
Actions and Subflows
Starts with a verb such as "Set Account Name" or "Send Amount to Fundraise Up"
Assignments, Get, Update, Create, Delete, Loop, Sort and Filter
Starts with Assign, Get, Update, Create, Delete, Loop, Sort and Filter
Decision
Always starts with a verb in the form of a question
Always a Yes/No type of question
Template | Example 1 | Example 2 |
---|---|---|
YesNoQuestion | FoundAccount? | BusinessAccount? |
Decision Outcomes
The Default Outcome is always a "No" because I only use Yes/No Decisions
For the Yes Outcome though
Template | Example 1 | Example 2 |
---|---|---|
Yes_SameDecisionAPIName | Yes_FoundAccount | Yes_BusinessAccount |
Hungarian Notation
Adding a prefix to the variable names is called "Hungarian Notation". Hungarian Notation is a naming convention used in computer programming where the name of a variable or function indicates its type or intended use.
Icons in Flows tell the Data Types
Every data type has an icon that helps you identify the data type.
So, what is the point of using a Hungarian Notation?
Sometimes the icon doesn't tell you exactly what this data type is, or you need more information about this variable type or use.
Text vs Formula with Text
Even though these are 3 different resources, they all have the same icon.
The WHY
- Find any resource or element you need by searching for the shared keyword
- Find all formulas by searching for 'fx'
- Find all text data type formulas by searching for 'fx_txt'
- and so on
- Keep every element and resource name unique, you don't have to have "Yes" and "Yes0" and "Yes00" and "Yes000" anymore.
- Distinguish between single and collection variables with the keyword "Col".
- Resources are sorted alphabetically, resources that share the same prefix are grouped together.
- Example:
TxtVar_OpportunityRecordType_Donation
is better thanTxtVar_DonationOpportunityRecordType
because all record types will be grouped together right below each other and won't be separated with other resources such as Dress Code.
- Example:
- I prefer
Txt
overT
andVar
overV
as a single letter is not very telling, and making it a full word is very long. "Var" is in the middle between "V" and "Variable".
By the way, I don't fully support the argument of "Flow like code" because of one very big fat reason that some Salesforce pros often just forget:
The target audience
Flows are made for Salesforce Admins and End Users. As Salesforce consultants, we share flows with customer admins and end users and sometimes we have to open the flow to show them how something works or if something needs to be updated in the future if ever.
(We should definitely give them a way to edit outside the flow but I am just saying it happens that we share screens and show the flow to a customer)
Most of the customers I worked with (40+) didn't hire a Salesforce admin. One of the team members would wear the hat of a Salesforce admin and most of the time, that is in addition to their previous role. No matter how tech-savvy that person is, you are not talking to a Salesforce Developer.
Conclusion
Keep it simple, keep it readable, keep it clear!!!