Loading
Slack 관련 문의처가 Salesforce Help로 통합 및 변경됩니다.더 많이 읽기

How to Dynamically Find Salesforce Object Prefixes to Reuse the Same Screen Flow Across Multiple Objects

게시 일자: Aug 18, 2026
상세 설명

Often times, we need to invoke a Salesforce Screen Flow from multiple different object records without creating a duplicate Flow, as the needs across these objects are the same. Using the same Screen Flow for multiple objects makes it hard to branch the Flow logic based on the Record ID that is passed to the Flow. We often hardcode the prefix of the records first 3 letters to find the object type. Hardcoding prefixes is a bad practice, as it’s different for sandbox and production for custom objects, though it remains the same for standard objects.

In this article, we will walk through how to achieve this requirement using best practices.

솔루션

In this use case, we are assuming that there is a Screen Flow that needs to be surfaced on two different objects, i.e. one standard and one custom.

Standard Object: Account (Api Name: Account)
Custom Object: Application (Api Name: Application__c)

Note: You can use this approach to bring more objects support to the same Screen Flow.

Step 1: Open Setup

Click the Gear Icon on the top right corner of your screen and select Setup.

Gear icon menu open in the top right corner, with Setup option highlighted

Step 2: Create a New Flow

From the quick find box, search for Flows and select the New Flow button.

Flows setup page with New Flow button highlighted

Step 3: Select Screen Flow Type

Select the Screen option under Categories and Screen Flow as the type of Flow.

Flow type selection screen with Screen category and Screen Flow type selected

Confirmation of Screen Flow type selected before creating the flow canvas

Step 4: Create the recordId Text Variable

Once the Flow canvas opens, create a Text Variable which will be used to bring the Record ID from the record where the Flow will be surfaced.

Notes:

  • Make sure you add the exact API name as provided below
  • It's a best practice to provide Descriptions to the elements
  • Make sure you mark the variable as Available for Input to bring the record details inside the Flow
Resource TypeVariable
API NamerecordId
DescriptionProvide a suitable description
Date TypeText
Availability Outside the FlowAvailable for Input

recordId text variable configuration panel showing API name, data type, and Available for Input checked

Step 5: Create the KeyPrefix_Formula Resource

Create a new resource of Formula resource type to find the first 3 characters from the left of the Record ID.

Resource TypeFormula
API NameKeyPrefix_Formula
DescriptionProvide a suitable description
Data TypeText
FormulaLEFT({!recordId},3)

KeyPrefix_Formula resource configuration showing LEFT(recordId, 3) formula"

Step 6: Get the Object's Entity Definition

Now, go back to the Flow canvas and select the Get Records element by clicking the + icon. We are using this Get Records element to fetch the Entity Definition of the object from where the Record ID is being passed.

In the Get Records Element, substitute the following values:

LabelGet Entity Definition
API NameGet_Entity_Definition
DescriptionProvide a suitable description
ObjectEntity Definition
Filter Conditions RequirementAll Conditions Are Met (AND)
Filter LogicKeyPrefix Equals {!KeyPrefix_Formula}
How Many Records to StoreOnly the first record
How Many Store Record DataChoose fields and let Salesforce do the rest and add QualifiedApiName

Get Records element configured to query Entity Definition filtered by KeyPrefix formula

Step 7: Add a Decision Element for Each Object

Now, add a Decision element, which is available when the + icon is selected.

In the Decision element, add two outcomes: one for the Account object and one for the Application object.

Notes:

  • Provide any suitable Label
  • It's optional but it's a best practice to provide Descriptions
  • Account and Application__c on the value side of the Outcome criteria shown below are the API names of the objects

a. For Account Outcome

LabelAccount
DescriptionProvide any suitable description
Condition Requirements to Execute Outcome{!Get_Entity_Definition.QualifiedApiName} Equals Account

Decision outcome configured for Account object matching QualifiedApiName

b. For Application Outcome

LabelApplication
DescriptionProvide any suitable description
Condition Requirements to Execute Outcome{!Get_Entity_Definition.QualifiedApiName} Equals Application__c

Decision outcome configured for Application object matching QualifiedApiName

Step 8: Add Object-Specific Flow Logic

Now, add your corresponding Flow logic in Account and Application outcome branches based on the use case you have. In this use case, two Screens were added to display a message for demo purposes.

Flow canvas showing separate screen elements branching from Account and Application decision outcomes

Step 9: Save the Flow

On the upper right side of the Flow canvas, hit the Save button and provide a suitable Flow name.

Save dialog for naming the new Screen Flow

Step 10: Activate the Flow

Finally, click the Activate button next to the Save button to activate the Flow.

Activate button next to Save button on the Flow canvas toolbar


About the Author

Written by: Ajaypreet Singh Saini | Forum Ambassador

Ajaypreet Singh Saini is working as a Salesforce Implementation Specialist at Grantbook. Prior to Grantbook, Ajaypreet served as a Salesforce Administrator for 2 years working on Sales Cloud where he was responsible for configuring and administrating complex processes and maintaining security of Salesforce Instance.

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

Knowledge 기사 번호

005131979

 
로드 중
Salesforce Help | Article