Is it possible to use Selection Page lookup with dynamically populated lookup values in Freedom UI
Hello,
I am working on a Freedom UI mini page where the lookup values are populated dynamically at runtime (not from a static entity data source).
Currently, I am using a crt.ComboBox and passing dynamically generated values into the list. However, I would like to use the standard lookup behavior (magnifier icon → selection page) to enable built-in search functionality.
The challenge is that the values are not coming from a fixed entity schema — they are generated dynamically based on contextual logic.
My question:
Is it possible to use the standard lookup selection page behavior with dynamically populated lookup values (without binding to a static EntityDataSource)?
If yes, what would be the recommended approach in Freedom UI?
Any guidance or best practices would be greatly appreciated.
Thank you!
Like
Hi,
I haven't done this yet by myself on lookup field, but on quick filter field with lookup type, the whole idea is the following. This is normal lookup fields parameters:
"PDS_Owner_7mvaqih": { "modelConfig": { "path": "PDS.Owner" } }, "PDS_Owner_7mvaqih_List": { "isCollection": true, "modelConfig": { "sortingConfig": { "default": [ { "columnName": "Name", "direction": "asc" } ] } } }
as we can see here PDS_Owner_7mvaqih is a field, and PDS_Owner_7mvaqih_List is some dataset, where some owner lookup values are stored. So you can manipulate with this lookup via JS as you wish (naturally, the structure of you values has to match exactly as it is by default), as you can see here in example:
{ request: "crt.HandleViewModelResumeRequest", handler: async (request, next) => { await next?.handle(request); const department = await UsrCommonModule.getCurrentUserTeam(true); if (!Ext.isEmpty(department)) { request.$context.PageParameters_LookupParameter1_7pw8znf = department; department.checkedState = true; delete department.primaryColorValue; delete department.primaryImageValue; request.$context.QuickFilter_orifxps_Value = [department]; } }, },
here we delete quick filter value by default and feel it with one record (actual user's department):
department.checkedState = true; delete department.primaryColorValue; delete department.primaryImageValue; request.$context.QuickFilter_orifxps_Value = [department];
So, referring to the first part I can do with PDS_Owner_7mvaqih_List everything I want by something like request.$context.PDS_Owner_7mvaqih_List = [{...}, {...}]
Exact structure for the request.$context.PDS_Owner_7mvaqih_List you can find out via debugger in the request.$context object.
I'll be glad to answer your possible questions :)