Loading

Salesforce Flow Variables Lose Values Navigating to Previous Screen

Data pubblicazione: Jun 13, 2025
Descrizione

Create a screen flow with some input fields on the Screen-1. Assign a value to a variable based on the inputs on ‌screen-1. It could be any data type. Now navigate to the next Screen-2, and click "Previous" button to return to the first screen. Observe that the variable loses it's value assigned to it via the input screen. Although the input screen might still retain those values.

In another scenario, save values from input screen-1 into a variable and perform a DB operation to insert/update a record and display screen-2 with record values. Now navigate to the previous flow screen by clicking the "Previous" button. Although the DB operation is complete and the record is inserted/updated. Observe that the variable, which was assigned values from screen-1, goes NULL. This may cause problems if we use it in a decision element to check whether the record in the first step was already created/updated or not, while moving forward again.

Risoluzione

This screen flow behavior is working as designed. To avoid this situation, follow one of the workarounds listed below:

  1. Disable navigation to the previous screen and create a one-way Flow to loop back to the first screen based on required conditions using another screen. This way, the value of the variable will be preserved.
  2. Hold the value of variables until the last step of the Flow to avoid any duplicate DB operation.
  3. Use the "Get Records" element if possible, and reassign an existing record or value to the same variable before the decision element so as to avoid any duplicate DB operation while moving forward the second time.
Numero articolo Knowledge

000380596

 
Caricamento
Salesforce Help | Article