You need to sign in to do that
Don't have an account?
![Siim Siim](https://dfc-org-production.my.site.com/img/userprofile/default_profile_45_v2.png)
VisualFlow data caching on revisiting iterative screens
I have a simple flow as follows:
1. Screen 1: Create a contact record Yes or No
2. Decision Yes or No
3. If i choose No, I go to the finish screen right away.
4. If Yes, I go to screen 2 when i enter the contact name, address etc
5. Then i save my contact record
6. Go back to step 1 which will ask me if i want to create a contact or not....
Q1: Here I have the same issue as mentionned in Here where the Yes is selected by default. Is there a way to bypass it?
Q2: I call my flow from a VF tab from the page as follows:
<apex:page sidebar="false" tabStyle="Contact" cache="false"> <flow:interview name="Ouverture_du_dossier_Client" finishLocation="{!URLFOR('/home/home.jsp')}"/> </apex:page>
When I run the flow from the VF page, and the second time I reach step 4, my contact form retains all the previous values i had entered and this is a pain. Please also note that I disabled caching in my browser. Has anyone encountered this data caching issue when revisiting flow screens?
Thanks in advance,
Siim
Yes, they have always cached and retained the previous values in my experience. I will be curious if there is a way to remove this as it's very unfortunate when someone cycles back through a Flow to have the values retained. Especially when it comes to picklist choices since once you select one you cannot "deselect" and not choose any values in a Flow.
There may be a workaround to "reset" all the values at the start or end of each Flow, I haven't tried but thought about it, but that's very cumbersome and time consuming if that's the only answer.
Darrell
Thanks for your response Darell, Is it recommended to revisit previous screens in a flow? Lets say I have a requirement to create a maximum of 10 contacts or a minimum of 1 contact then proceed to other steps in a flow. How would that be achieved? Someone has a better solution for this than supporting a maximum of 10 contact input screens in a flow? I even tried defaulting the input texts to the global empty string but to no avail.
Thanks in advance,
Siim
Unfortunately, I don't know your answer. Sometimes the Flow developer chimes in with a workaround, sometimes some code he has created for some typical issues such as this. Might want to search his github account to see if anything up there. I don't have the link to it here but if you search this board you will find it and might find a workaround.
I've not played with Apex Plug ins yet so not sure if someway to reset the variables using that when you get to the end of the Contact creation.
I also noticed that this issue is actually from the flow itself this happens even when running the flow from the flow detail page a or from URL too. Too bad, and this limits the use of flows when it comes to iterative steps in a flow.
I am in the process of implementing flows to rework nearly all of our custom daily operations as well as any standard SalesForce item that takes more clicks than needed and I have not come across this caching issue when using "forward momentum flows". If using the "previous" button within a flow, the caching does occur, as it was designed to do. We have many flows that require a great deal of input values which will populate additional record info; as the user creates new records. Many times this will require the user to click the "previous" button to change a value and, without the caching, would require 20-30 fields to be re-entered.
Based on the info provided I am assuming you are using the "previous" button to get back to screen 1. If not, there are a couple of items on your post that are a little unclear.
1. Screen 1. What type of field//fields are Yes/No(radio, dropdown, dynamics, etc)?
2. You mentioned "Go back to step 1". Was this done by clicking the "previous" button or the "finished" button?
3. If it is the "finish" button how are you getting back to the flow? (Based on your VF page when "finished" is clicked, it will redirect to the main SF home screen)
4. "Call my flow from a VF tab" I am assuming you created a VF Tab (CustomTab Definition) as opposed to a custom button on an object, as there is no "controller" in your VF page.
5. Are you trying to pass any values from a record into the flow as a variable so the contact could be related to an existing record (pass the account record id to relate the contact to the account).
I recreated your flow and tried to account for all the unknowns and was unable to recreate the issue you are having using the flow, as it is currently designed (not clicking the "previous" button to restart the flow). I have created 100's of flows and have yet to find any reason to utilize the "previous" button other than to correct a mistaken input prior to any data or logic function.
In regards to your question about the 10 max/1 min contact screens. Are you speaking of how the user would view it or dealing with the logic within the flow.
As an example:
We had an issue in where the normal contact to account relationship did not work for us. We needed to tie 2-3 contacts to many accounts (child). We also needed tie these child accounts to 1 parent account, and make sure the correct contact was tied to their correlating child account; as well as tie one parent contact to the correlating parent account and then tie the child contact to the parent contact. Simply by adding the custom object without having to use any type of real coding such as VF pages, Apex, Force, etc, we were able to create a flow in where the user saw a total of 2 screens: Screen 1 has one input field and Screen 2 only contained a “Finish” button that brought us back to screen 1. Based on this example, yes, there were multiple screens within the flow design, but the user only saw two screens.
Within four to five hours we were able to convert over 700 parent accounts, 2,000 child accounts, 700 parent contacts and 1,200 child contacts. In the end, a flow is a very powerful tool with the ability to do many things that, without it, would require code to accomplish the same thing. The trick is to understand the nuances within. If you can give me a little more information, I may already come across a solution for some of the hurdles you are dealing with.
Thanks for your feedback FMD, am sorry for the lack of info in my post.
My requirement and issue is as follows:-
Screen 1: Standard Welcome
Screen 2: Contact screen
Do you want to create contact?
Radio button answer Yes/No
Decision: Decision to create contact or not?
Based on the user’s selected choice, if
Screen 3:
2. YES – Open the contact registration screen 3:
Here, we have at least 10 to 15 fields which the user has to fill in.
Record Create:
Save the current contact details THEN user gets back to screen 2 again (using flow arrows)
What's happening here say for sibling 1, I have the following info
Firstname: test
Name: Sibling 1
Gender: Female (radio button)
Category: Sibling - dropdown list (Sibling /Cousin/Other)
Address1: 13322 Don Street
Profession: Doctor
.
.
.
After Sibling 1 is saved, when I come back to screen 3 the above values are pre-populated.
This happens even if I run the flow from the URL or from a VF tab.
The idea behind this part of the flow is to register a contact and then register his/her siblings and cousins…. . Thus support a minimum of 0 or 1 sibling up to a maximum of 6-10. No account involved.
Also, I do not use back button, its the flow arrow to point the flow back to screen 3 after recordCreate.
I understand it is difficult to imagine what am trying to describe without a diagram but unfortunately the board does not allow me to add screenshots...
And yes, this is different than the back button. I would agree that keeping the values persistent when using the Back button is likely wanted behavior. The posting is referring to "looping" through same Flow. I've experienced exactly what he is describing and have not found a workaround at all. Looping should not keep the same values.
I completely agree that it is very difficult to explain and understand factors, when dealing with flows. Unlike Apex, VF, etc where you can post the actually code, flows are not so black and white. There should be an easier way to post the data needed to help. From the info you provided I can see what the issue is and agree with DarrelID. You are "looping" your flow, which is what is causing the cache issue. However there SHOULD be way to solve this problem. I believe I understand what you are trying to accomplish and it would seem your flow is pretty straight forward. Depending on the logic and complexity of a flow one or more of these scenarios should solve the issue.
A. If you need to keep the welcome screen (the user would see the welcome screen each time when creating a new record)
1. Create a button instead of VF tab. (this would eliminate the VF page) Remove the arrow from the record create screen to screen 2 and allow the flow to finish and recycle back to the welcome screen.
2. Remove the arrow from the record create screen to screen 2, allow the flow to finish and recycle back to the welcome screen. Update your current VF page to the one below.
<apex:page sidebar="false" tabStyle="Contact" cache="false">
<flow:interview name="Ouverture_du_dossier_Client" finishLocation="{!URLFOR('/flow/Ouverture_du_dossier_Client')}"/>
</apex:page>
3. Remove the arrow from the record create screen to screen 2 . Highlight(right click and drag) all screens, copy and paste the flow. Then attach record create screen (of the original flow) to welcome screen of the second flow.(copy and paste as many times as needed. This would require a little more info depending on the logic of how many contacts are needed from the start)
B. Removing the Welcome screen completely.
1. All the same scenarios will work above if you remove the welcome screen.
C. Keep the original welcome screen and user will never see it again after the initial run through. This is a little tricky at first but not that hard. Again, this follows the above logic.
1. Remove arrow from create screen to screen 2 and save flow.(Flow1 Master Flow) Create a brand new flow(Flow 2, independent flow, child flow) that mirrors flow 1 except for the welcome screen and save flow. Go back into flow 1 and on your left you will see a list of flows(subflow child). Drag the subflow and attach the create record of Flow 1 to screen 2 of Flow 2. You will need to create input/output values to make it work. (If you get stuck let me know)
These are some of the aspects we have used to solve our issues based on the core logic of the flow. Some of the examples might seem redundant but they all have their place in certain context. What we have learned based on the current version of flows is "no backward motion" and let the flow "complete a full thought"
Thanks FMD,for your suggestions,
Just to let you know, the flow i described here is part of a more flow.
Just to simplify things, i added the welcome and end screen. Actually you can substitute the welcome and end screen with steps...which are complex in themselves.
I did try embedding the simple described loop flow in VF tab and VF page with attribute cache=false, but to no avail.
In brief the business requirement is as follows:
1. Create primary contact if it does not exist in system,
2. Create family and link it to primary contact
3. Create parents(minimum 1 ) and link to primary contact
4. Create siblings, link to primary contact and also link to one of the parents created in 3.
Throughout the flow I have to keep creating contacts depending on the user's input and having the primary contact id and other parameters as variables to be used throughout the system.
So Removing the so-called "Welcome screen" is not a solution in my case as i have other steps before and i can;t start the flow with screen 2.
My only option left is same as your point A3 but this will make the flow too bulky and and complex to maintain.
However,I even thought about the C1 but was not sure how to do it. Based on you suggestion, i will try it out and let you know which one works.
Thanks again for suggestions,
Siim
I'll just pipe in with one last item about "cant start Flow at step X". Sounds like this might be a lengthy Flow and, if so, its best to use the subflows in this case. Easier to manage and gives you much better control over where to direct people. So in this case, the creation of a contact should be its own Flow and then becomes a subflow. This potentially allows you go have someone "start" there based on other criteria, possibly from the Master Flow.
So for instance, you set a variable in Master Flow - mastervar = 1. If = 1 then don't bring person to start of this Flow but bring to Contact creation Flow, etc. There's also another way by using the VF page and setting an "EntryPoint" variable. Your Flow then starts with a Decision and directs person to whatever step you want to start with.
I didn't read through the entire answer about the caching and will do that later as the above has nothing to do with that and I've still not seen anyway, even using SubFlows, where the caching doesn't happen so I'm curious about the answer.
Darrell