How can i use the List Size of Record Choice Set to dynamically display informational message on the screen only if the Record Choice Set returns no result. Is it doable without using a Get Records and using only the Record Choice Set to render either the Choice Set OR the informational message on the same screen depending on the result of Record Choice Set.
-
Did you find an answer? I have the same problem. Also, Is it possible to create Record Choice Set using collection variable ?– lambadJul 24, 2020 at 13:17
-
@lambad no i did not find any. Had to keep a Get Records. Also,using collection variable does not seem to work for Record choice set.– starhunterJul 28, 2020 at 15:09
1 Answer
For anyone still wondering about this, it's a bit fiddly because you cant use formula operators such as ISBLANK or LEN on choice sets. And yes, you do need to start with GET RECORDS, but then use a COLLECTION CHOICE SET instead of a RECORD CHOICE SET as follows:
- Use a GET RECORDS flow element to assemble a record collection for the records you are after. When populating the set be sure to include the fields that you would like to become the label and value of the resulting choice set.
- Create a new numeric variable resource, say, numRecords.
- Add an ASSIGNMENT flow element that sets numRecords to the size of the record collection using the EQUALS COUNT operator.
- Create a COLLECTION CHOICE SET resource based on the record collection.
- Add a CHECK BOX GROUP / PICKLIST screen component to your screen element, specifying the COLLECTION CHOICE SET as your choice resource.
- Use numRecords in the component visibility logic as required, eg numRecords>0.
It's a little counter-intuitive because you might imagine you can as easily apply the EQUALS COUNT operator to a choice set as a record collection, but I'm afraid not - EQUALS COUNT only works for collections.