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
DarrellDDarrellD 

Decisions for Blank Dynamic Choices

Anyone know how to build in a decision if the Dynamic Choice returns nothing (blank)?  I've tried the usual suspects such as the Global.Constant.Empty.String and not working.

 

So if a user searches for a Contact "Luke" and there is no Luke I want to route them somewhere else vs when there are some Lukes to choose from.

 

Darrell

Best Answer chosen by Admin (Salesforce Developers) 
RajaramRajaram

Dynamic choices are UI elements so using them in a screen would mean the user may not be presented with any options.

If you want this, you could add a static "Not any or not found" choice after the dynamic choice in which case the user can select not found as the choice. If this is the case, then your decision could be "not any or not found was selected true".

If you want to do this as a non-ui option, then you have to use a record lookup and can use "record lookup equals true" in your decision to decide branching on a lookup hit or not. In this case, taking the true path would always result in the dynamic choice having valid results - but be aware what are doing 2 queries, so so long as they are performant and not scannig entire 2 million records! :)

 

hope this helps..

 

All Answers

RajaramRajaram

Dynamic choices are UI elements so using them in a screen would mean the user may not be presented with any options.

If you want this, you could add a static "Not any or not found" choice after the dynamic choice in which case the user can select not found as the choice. If this is the case, then your decision could be "not any or not found was selected true".

If you want to do this as a non-ui option, then you have to use a record lookup and can use "record lookup equals true" in your decision to decide branching on a lookup hit or not. In this case, taking the true path would always result in the dynamic choice having valid results - but be aware what are doing 2 queries, so so long as they are performant and not scannig entire 2 million records! :)

 

hope this helps..

 

This was selected as the best answer
DarrellDDarrellD

Yes, the workaround about having another choice is what we've actually been doing since inception.  I was hoping to get rid of that for couple reasons.

 

1. If you have the "None" option and there are Dynamic Choices (DC) present, there is no way to stop someone from selecting BOTH a DC and the None option at that screen.  Yes, can have decision later but person would have to go back. BUT

 

2. The biggest issue is that you cannot deselect a choice option.  So if above happens, there is no way for someone to unselect the "None" option once they have selected it.  Same holds for DC, cannot select an option then decide you don't want to select any options.

 

Both of the above are somewhat major issues with #2 being biggest problem.

 

What we ended up putting in for a slightly different workaround is a Record Lookup first that checks to ensure the DC has at least 1 result returned. If so, presents the DC options, else it goes to a different screen that doesn't have DC options.

 

Thanks!