Skip to content

How to Avoid Record Type ID Hard Coding in Salesforce Flow?

How Avoid Record Type ID or Queue ID Hard Coding in Salesforce Flow?

One of the most important Salesforce Flow Best Practice is to avoid hard coding Salesforce record IDs in Flow as these record IDs may change when the flow is migrated to another sandbox or production.

Instead of hard coding record IDs you can query them and use it later in the flow.

1. How to get Record Type ID in a Flow?

You can get the Record Type ID by querying the Record Type object and filtering by SobjectType = “Object Name Lead in this example” and Developer Name = “Developer Name of your object, ‘Auto_Loan’ in this example”

Avoid ID Hard Coding in Flow:  Get Record Type ID

2. How to get Queue ID in a Flow?

You can get the Queue ID by querying the Group objects and filtering by Type = “Queue” and Developer Name = “Developer Name of your Queue in this example Hot_Leads”

Avoid ID Hard Coding in Flow: Query Queue ID in Salesforce Flow

3. How to use the Queried ID in Create or Update Record Element in a Flow?

You can use the record IDs queried in previous steps in Create or Update Record elements later in the Flow.

Create Records

4. What if you don’t want to Hard Code the Developer Name?

There may be scenarios where the Queue or Record Type developer names may change between orgs and you don’t want to hard code the developer name in Flow.

You can store the Quote or Record Type developer name in Custom Label, Custom Setting or Custom Metadata Type and refer it in the flow.

  • Custom Label – Create a Formula field which will use the Custom Label and use it in the Flow
  • Custom Setting – Create a Formula field which will use the custom Label and use it in the Flow
  • Custom Metadata Type – Create a Custom Metadata Type, create a field to store the developer name of the Lead Record Type and query the values in the flow
Avoid ID Hard Coding in Flow: Get Meta Data Type
Use Metadata Type in Get Records

5. Additional Resources


Recommend Articles

Tags:

Share this article...

Please Leave a Comment

error: Content is protected !!

Discover more from DYDC

Subscribe now to keep reading and get access to the full archive.

Continue reading