function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
conradvillaconradvilla 

Flow - Clear Input Values

I've written a rather intricate flow which asks a number of questions from the user and then using APEX it creates a record to a custom object, based ont he user input.

 

The issue I face is that at the end of the Flow, I prompt the user to enter another record (against the same Master) and if they answer Yes, the Flow will repeat.  However, it retains all of the prior input.  Is there a way to clear all user input prior to repeating the flow?

Best Answer chosen by Admin (Salesforce Developers) 
Jeff KranzJeff Kranz

I have successfully implemented a workaround for this by separating the input screens and the looping logic into separate flows, and using the input screens flow as an embedded flow within the looping logic flow.

 

Flow 1: Contains the input screen(s).  You can create/manipulate records within this flow or assign the inputs to variables exposed as outputs for the flow

 

Flow 2: Embeds Flow 1, performs logic needed for looping, can also take the outputs from Flow 1 to create/manipulate records or make decisions.

 

When implemented this way, Flow 1 will reset its input fields to their default values each time that it runs within Flow 2.

All Answers

DarrellDDarrellD

Search this board a little and you'll see the same question asked. Unless someone has thrown in some kind of Apex Plug in to do this since I last checked, the answer is "No". Right now it retains all of the values previously entered. Even if you try to get creative and clear them yourself in a loop it doesn't work.

 

I'm hoping this is high up on the improvements board because it's a problem. Made worse by fact that you cannot "unselect" picklist values.

 

Darrell

RajaramRajaram
Yeah.. the standard implementation is to mimic the browser which shows the previous selection.
THis is something we have on the backlog already.
Jeff KranzJeff Kranz

I have successfully implemented a workaround for this by separating the input screens and the looping logic into separate flows, and using the input screens flow as an embedded flow within the looping logic flow.

 

Flow 1: Contains the input screen(s).  You can create/manipulate records within this flow or assign the inputs to variables exposed as outputs for the flow

 

Flow 2: Embeds Flow 1, performs logic needed for looping, can also take the outputs from Flow 1 to create/manipulate records or make decisions.

 

When implemented this way, Flow 1 will reset its input fields to their default values each time that it runs within Flow 2.

This was selected as the best answer
RajaramRajaram
oh Wow! Cool.. may be you can do a blog post it on the boards so that others may use this solution?
Thanks!
Jeff KranzJeff Kranz

Thanks!  Yeah, some sort of cloud flow "tips, tricks, and gotchas" blog post is definitely on my to-do list.  In the meantime, lets mark the solution as solved so that others can easily find it.

srichardsonsrichardson

This works very well. Excellent tip and thank you jakranz33

Mitch_AMSMitch_AMS
I too had this issue, what I did was create four(4) variables, that contained a null default value (1-text, 1-number, 1-boolen, 1-date). After the flow created the record, an assigment was used to change all of the stored variables back to a nul value before returning the user to beginning of the flow...  This worked for me... as far as I could tell...  Based on the comments above, perhaps I should double check, but I thought I tested it and it worked...
Tracey Keitt 1Tracey Keitt 1
I've tried the sub flow approach that Jeff Kranz suggested but it's not clearing the Screens as explained. Has anyone been able to solve this problem using the same approach recently. Thanks for any insight!
Mclyssa Nunes 10Mclyssa Nunes 10
In case it helps, I just created a new assignment element and added the fields to be cleared but left assigned values blank, didnt assign anything and this cleared out the values. Thanks to Mitch_AMS I got this idea and it seems to work for now.