Loading

How to Add a Prefix Value to Salesforce Sales Account Name

Дата публикации: Aug 18, 2026
Описание

Add a prefix to an Account name during creation if the Account has a specific Record Type, Ensuring consistent naming for easy identification.

Решение

This resolution shows how to automatically add a prefix to an Account's Name when it's created with a specific Record Type, using a Record-Triggered Flow.

Context: We have previously defined a Record Type Vendor for the Account object. It is the record type that will be used for this article.

 

Flow overview, Vendor record type list

Flow canvas showing all elements

Create the Flow

Step 1: Create a Record-Triggered Flow

  1. Go to Setup, type Flows in the Quick Find box
  2. Click New Flow
  3. Select Start From Scratch, click Next
  4. Select Record-Triggered Flow type, and click Create

Step 2: Configure the Start Element

  1. Choose the following object: Account
  2. Set the trigger to fire when: A record is created
  3. Keep the entry conditions to None for now, since we cannot set a filter on Record Type name from there
  4. Select the mode to optimize the Flow for Fast Field Updates

Start element configuration with object Account and trigger settings

Define the Constants

Step 3: Create a Variable to Store the Record Type Name

  1. Click the Toggle Toolbox button located in the upper left corner of the Flow Builder page
  2. Click New Resource

New Resource menu in Flow Builder toolbox

Step 4: Set the Record Type Constant

Choose Resource Type as Constant, Data Type as Text, and Value as Vendor. Click Done.

New Resource dialog with Constant type, Text data type, value "Vendor"

Note: When typing the Constant value, you are proposed to select a predefined Constant value. But here we will just type the text value as free text.

Step 5: Create the Prefix Constant

Create a second Constant resource to store the prefix used in the Flow. This prefix could also be managed outside of the Flow using a Custom Metadata Type.

  1. Choose Resource Type as Constant, Data Type as Text, and Value as V-. Click Done

New Resource dialog with Constant value "V-"

Retrieve and Update the Record

Step 6: Add a Get Records Element

Add a Get Records element to retrieve the Record Type Id from its name.

  1. Click + to add an element between Start and End, and select Get Records
  2. Define a Label and a Description. Check the generated API Name
  3. Select the Record Type object where the Name equals the Account Record Type name previously created as a Constant
  4. Choose to store: Only the first record
  5. For record data: Automatically store all fields

Get Records element configuration for Record Type

Step 7: Create an Update Records Element

  1. Click + to add an Update Records element after the Get Records element
  2. Define a Label and a Description. Check the generated API Name
  3. The option Use the account record that triggered the flow is greyed out and checked
  4. Add the following conditions:
    • RecordTypeId Equals {!Get_RecordType_Resource.Id} — the Id retrieved from the previous Get Records element
    • Name Starts With {!prefixForConcernedAccount} — the constant value of the defined prefix V-
    • Custom Condition Logic: 1 AND (NOT 2) — to update the account only if it's a vendor account that does not already start with V-

Update Records conditions with RecordTypeId and Name Starts With

Step 8: Set the Field Value for Name

  1. Choose Name for the Field to update
  2. For the value, click the input field and select + New Resource, choose Resource Type as Formula
  3. Choose Data Type as Text
  4. For the value:
    • From the Formula section, insert a resource: the Constant section, select the defined prefix constant {!prefixForConcernedAccount}
    • Type a +
    • Insert another resource: go to Global Variables, choose the triggering record, then choose the Name field: {!$Record.Name}

Formula resource combining prefix constant and $Record.Name

Save and Activate

Step 9: Check Syntax

Click Check Syntax, then click Done.

Step 10: Save and Activate the Flow

Save the Flow and Activate it.


Written by: Eric BURTÉ | Forum Ambassador

Based in France, Eric Burté is Head of Salesforce and AI, within DEVOTEAM Group.
As a Salesforce Expert Director, Eric works with project teams, to support them on the design, build and delivery of their Salesforce projects, and works with his clients in assessment project context, Salesforce 'Center of Excellence' teams management, or Design Authority approach implementation.

Submissions reflect only the opinions of the user who made available the Submission and not the opinions of Salesforce, regardless of whether the user is affiliated with Salesforce, and may contain or constitute products, services, information, data, content and other materials made available by or on behalf of third parties ("Third Party Materials). Salesforce neither controls nor endorses, nor is Salesforce responsible for, any Third Party Materials, including their accuracy, validity, timeliness, completeness, reliability, integrity, quality, legality, usefulness or safety, or any applicable intellectual property rights. Any Submissions made available through any message board or forum in response to posted questions, or that otherwise purports to answer any questions, including any questions about Salesforce or Programs, are made available for your general knowledge only and should never be relied upon as answers to your specific questions (even if an answer is marked as a "best" answer or with any similar qualifications). You should always contact Salesforce support for answers to your specific questions. Salesforce has no control over Submissions, and is not responsible for any use or misuse (including any distribution) by any third party of Submissions.

If you have questions, tap into the wisdom of our entire Trailblazer Community here: https://trailhead.salesforce.com/trailblazer-community/feed

Дополнительные ресурсы
Номер статьи базы знаний

004633778

 
Загрузка
Salesforce Help | Article