Loading

Salesforce Flow Variables Lose Values When Navigating to Previous Screen (Working as Designed)

Data pubblicazione: Jun 5, 2026
Descrizione

Issue: Flow Variables Reset When Navigating to Previous Screen

When you create a screen flow with input fields on Screen 1 and assign a variable based on those inputs, navigating to Screen 2 and then clicking the Previous button to return to Screen 1 causes the variable to lose the value that was assigned on Screen 1. The input fields on the screen may still visually retain their values, but the underlying variable value is reset.
Second scenario: If you save values from Screen 1 into a variable and perform a database operation — such as inserting or updating a record using a Create Records or Update Records element — and then display Screen 2 with the resulting record values, clicking Previous causes the variable that was assigned values from Screen 1 to become NULL. This can cause problems if a decision element later checks whether the record was already created or updated during the forward pass, since the variable no longer holds that indicator value after navigating backward.

Risoluzione

Why This Happens

This screen flow behavior is working as designed by Salesforce. When a user navigates to a previous screen, the Salesforce Flow engine resets variable values assigned during that portion of the flow. This is an intentional behavior to maintain flow state consistency.

Workarounds

To avoid this issue, use one of the following workarounds:
Workaround 1: Disable backward navigation and design a forward-only loop. Disable navigation to the previous screen and design the flow to loop back to the first screen based on required conditions using a separate screen or decision element. Because the flow never navigates backward — it redirects forward to the appropriate screen — the value of the variable is preserved throughout. This is the recommended approach when backward navigation is not a business requirement.
Workaround 2: Delay database operations until the final screen confirmation. Hold the value of all variables and avoid performing database operations (such as creating or updating records using the Create Records or Update Records element) until the user confirms on the last screen. This prevents the situation where navigating backward results in duplicate records being created, since the database write has not yet occurred.
Workaround 3: Use the Get Records element to detect and reassign an existing record. Use the Get Records element to retrieve a record that may already have been created, and reassign its field values to the same variable before the decision element. This allows the decision element to detect that the record was already created and skip the creation step when the user moves forward again after having navigated backward.

Numero articolo Knowledge

000380596

 
Caricamento
Salesforce Help | Article