Salesforce Tips To Retain Flow Variable Values To Previous Screen

In this post, we will talk about salesforce tips to retain flow variable values to previous Screen .
For this salesforce has already suggested us a workaround of it.
I will try to help you with the solution and demo. Please be with me till the end in order to make it more interactive and easier to implement.

Requirement Overview

  • Design a screen flow with some input fields on screen1 and assign value to a variable based on the inputs on the screen1. It could be any data type.
  • Navigate to the next screen that is screen2 and click the “Previous” button to return to the first screen.
  • You will notice that the first screen variable loses its value assigned to it via the input screen where it might happen that the input screen still retains those values.

Solution Approach

You can solve this limitation using a screen flow where you will be designing two subsequent screens.

Assignment Element is used to satisfy the requirement.

A Lightning web component is primarily used for navigating between the screen.

The Screen Flow footer is disabled.

The navigation buttons provided by the Lightning web component track the back button click event.

Review the Advance option used for the back button variable. (varBackClicked).


The attached screenshot will provide you with a fair understanding of the implementation.

Flow Design
First Screen
Second Screen
The back button clicked from the second screen

Sample Code


For raw code , go to the git repo here


Imposing the assignment element between screens helps in retaining the values whereas the back button present in the lightning web component tracks the navigation.

Salesforce Tips To Retain Flow Variable Values To Previous Screen, I Hope you find this post useful! Catch you in the next content.
And thank you for being an awesome reader.
Share and grow together !!

If you have any doubts you can comment down below, I will try to reply ASAP.

Also keep visiting us, for more such content!

Adil Ansari

Md.Adil is a Senior Salesforce developer, a Computer Science graduate working on the Salesforce platform and providing customer solutions using as a Salesforce consultant/developer. He is the founder of SalesforceBitsandBytes blogging site. He shares unique real time posts on different Salesforce implementations, the source code available on this SalesforceBitsandBytes blog is fully tested in the development environment.

One thought on “Salesforce Tips To Retain Flow Variable Values To Previous Screen

  1. Hello there, just became alert to your blog through Google, and found that it’s really informative.
    I’m gonna watch out for brussels. I will appreciate if you continue this in future.
    A lot of people will be benefited from your writing.

Leave a Reply

Your email address will not be published. Required fields are marked *