Loading

How to deal with the behavior of replacing hard-coded organization IDs in formulas when creating or refreshing a sandbox

Дата публикации: Dec 11, 2025
Описание

Learn why the Organization ID in Flow formulas changes in a Sandbox. Use a formula resource to prevent this replacement and correctly identify the environment.

As a Salesforce specification, the Organization ID is changed to a new unique ID each time a Sandbox is created or refreshed.

When this happens, 15-digit Organization ID written directly in a Flow's decision element, for example, is automatically replaced with the Organization ID of the new Sandbox.

This is normal behavior, designed to prevent unintentional processing in the Production environment.

Решение

To prevent the Organization ID replacement and correctly identify the Production environment, create a formula resource and use it in a Decision element. This method compares the last 13 characters of the ID.

 

1.In Flow Builder, click [New Resource] in the Toolbox.

2.For Resource Type, select [Formula] and enter an API Name.

3.For Data Type, select [Boolean].

4.In the [Formula] field, enter the following formula:

==

IF( RIGHT( $Organization.Id , 13)="DXXXXXXXXXXXX" , true, false)

==

Note: Replace "DXXXXXXXXXXXX" with the last 13 characters of your Production Organization ID (excluding the leading "00").

5.Click [Done].

6.In a Decision element, configure the outcome to check if the formula resource is {!$GlobalConstant.True}.

 

This setting allows the flow to correctly determine whether the environment it is currently running in is the production environment, and prevents values ​​from being accidentally changed when creating a Sandbox.

Дополнительные ресурсы

Servers and IDs

RIGHT

Номер статьи базы знаний

005134850

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