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
shawshankshawshank 

Visual Workflow Designer - Sorting Choice Lookup Element

Other than creating and referencing a static list in workflow designer, is there any way to control the sorting of the drop-down in a choice lookup element?

 

I have a choice lookup element that references a custom object in Salesforce.  The column value that I am displaying is the Name of the custom object and I would like the drop-down to sort in order on this Name; however, when selecting this drop-down, the Names are listed randomly...probably keying off of some other column.  

I do not see a way in either the choice lookup element or the question element to control the sort order for the drop-down.  If it was a simple question not connected to a choice element, there is control, but not when connecting to a choice lookup.  

swoodswood

If you're using the desktop design tool, you can create a data source that uses SOQL rather than a standard table lookup.  So, you basically put the "ORDER BY" in the "Advanced Filter" (or similar) in your data source.  You then use this data source for your choices.  Hope that makes sense - and yes - it's less than ideal :(

 

We are adding ORDER BY to the choice lookup as part of the cloud designer - this is obviously a popular request.

 

Cheers,


Steve

shawshankshawshank

I have attempted to build an advanced script, but no values will show up in my question element associated with my custom object.  To clarify, no drop-down box even shows up.  There are no errors on the SOQL query as tested in the workflow designer.  I have verified that all connections are working by connecting directly to the custom object...values show up in the question element when using the non-SOQL data source.

 

Here's my script:

 

SELECT Id, Name, Square_Feet__c, Bathroom_Count__c, Bedroom_Count__c, Floors__c, Product_Family__c  

FROM Model__c

WHERE Active__c = TRUE

ORDER BY Square_Feet__c, Name

 

I have tried the script without the WHERE and ORDER BY conditions with no results as well.

 

I verfied that the advanced script will work on a standard object such as Products2.  For some reason, it is not working on my custom object (Model__c).  I know that the advanced script will not handle SOQL grouping and relationship functions.  Are there any special restrictions with custom objects?

shawshankshawshank

After additional testing, it is clear that the advanced scripting does not allow more than one ORDER BY condition.  If you place two conditions, there are no results.

RajaramRajaram

Yes, This is a known limitation and we have this being tracked in the backlog.

NSmyrnosNSmyrnos

Has there been any movement on this?  I am running into this ordering limitation on Cloud Designer with my latest flow, and don't see any UI controls to modify the order of returned results.