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
sunnydalesunnydale 

Assign stored value to a Visual Workflow Radio Button field

I want to run a VWF multiple times.  The first time, it should create a new object instances (which it does just fine).  Subsequent flow runs I want to pre-populate the screen Radio Buttons with the previously stored values.  I can retrieve the instance attribute stored values just fine into VWF variables, but I don't see a way to assign a variable to a radio button screen choice field. 

 

Example:  Radio Button screen choice field (20 of them in total) each with 3 choices (Pass, Fail, Needs Review as the stored choice value).  For each Radio Button screen choice field, there's a custom field (type Text) that has one of Pass, Fail or Needs Review strings assigned to it. 

 

I don't see it as practical (20 x 3 = 60 Decision) to try to work out which choice relates to the custom field's stored value and set the screen choice value at the choice element level.  But that appears to be the only option.  Am I missing something?

Best Answer chosen by Admin (Salesforce Developers) 
RajaramRajaram

Ah yes.. What you want is what we call dynamic defaults where you want to specify the default choice based on a merge field. 

This is something we want to support and is on the roadmap already.

Feel free to post an idea on the ideaExchange and let other vote!

All Answers

RajaramRajaram

Hmm still not sure what you are trying to do.. But you can create a choice whole label and stored value value be a merge field.

So you can have the following

Choice 1:

 Label: C1

 Stored Value: C1

Choice 2:

 Label: C2

 Stored Value: C2

Choice 3:

 Label: {!var1}

 Stored Value: {!var2}

 

You can assign the value of var1, var2 however  you want.

 

Hope this helps.. but I would still like to understand your use case better..

 

 

 

dlampdlamp

Let me try it this way.

 

If I put a Textbox field on a Screen element, I have these options:

 

Label:  My field

Unique Name: My_field

Input Type: Textbox (non-editable)

Default Value:  myVar

 

Given this, I can retrieve a stored record, assign a field value in that record to a svar, and then select svar as the Default Value:

 

But if I have a Choice Radio Button Field, I have these options:

 

Label: My field

Unique Name:  My_field

Choice Type:  Radio Buttons  (non-editable)

Value Data Type:  Text

Required:  Check

Default Value:  --Select One -- (followed by list of var's associated with the choice settings)

 

In the case of the Textbox, the Default Value options offers all defined variables.  But in the case of Radio Buttons, the only Default Values are the variables associated with the Choice Settings.  Since in both cases I store the single value of each field in a Text field, I really wanted to just be able to assign the screen field the default value in the same way.

 

More perplexing is how I could get from a retrieved text value in a var to the right one of the Radio Choice Setting options vars?  The only way I can think to do this given that formulas only work with number results is using Decision elements.  But that's painful just to think about.

 

Dynamic Choices are also not an option because I don't have a Picklist in the underlying storage object.  But perhaps that's what I need to have?

RajaramRajaram

Ah yes.. What you want is what we call dynamic defaults where you want to specify the default choice based on a merge field. 

This is something we want to support and is on the roadmap already.

Feel free to post an idea on the ideaExchange and let other vote!

This was selected as the best answer
dlampdlamp

Thx very much.  I really wish Mr. Benioff would give you guys half his R&D budget for a year.  For us, VWF is the most profound capability delivery tool on the platform.  We'd probably roll out new functionality daily if we were not side-tracked fighting the VWF growing pains at every other turn.  We've "retired" thousands of lines of Apex code with VWF replacements, and shortened the turn-around time for enhancements from 2 weeks to as little as 5 minutes. 

 

No Software! 

 

Do keep at it....you have a killer capability in the making :-)

dlampdlamp

Seems to me the fundamental issue here is whether Choice Fields are data fields (say like the Textbox field) or something less or different than that. 

 

Given that there's no way to assign dynamic default values from any source (var, formula, merge field, another screen field--not that the latter would be easy) to a choice field (either dropdown or radio button), it seems to me that they are different. 

 

Perhaps the development team sees them as a hybrid "data / flow control" element, particularly useful when the decision inputs are greater than 2.  This conclusion seems supported by the fact that Dropdown fields are aleays required fields in a running flow--makes sense if they are seen as collecting information to guide the flow, but rather less so if the field is "just for data collection". 

 

But I suspect that many first-users of VWF assume that choice fields are first-class data fields--just like a textbox.  Sadly, they clearly are not.  My guess is that in many cases this discovery comes as a bit of a surprise :-(

Lauren SmithLauren Smith
Does anyone have an update on this issue - if we can have choices display a stored value?