Filter Selection window Contact lookup in freedom ui mini page

I Have a mini page with page parameter  named "Owner" of type "Contact" lookup.
It's "Lookup view" = "Selection window".

Once Clicked, i need to filter the selection window to show only contacts of "Type"="Employee"

* NOTE!  When i set the "lookup view as "Dropdown list" i can use the code: (and it works)

            {
                request: "crt.LoadDataRequest",
                handler: async (request, next) => {;
                    console.log(request.dataSourceName);                                                   
                    if(request.dataSourceName == "PageParameters_WtrLookupParameter1_xkzokyf_List_DS") {
                        const filter = new sdk.FilterGroup();
                        const emploeeType = "60733efc-f36b-1410-a883-16d83cab0980";
                        await filter.addSchemaColumnFilterWithParameter(sdk.ComparisonType.Equal, "Type", emploeeType);
                        const newFilter = Object.assign({}, filter);
                        newFilter.items = filter.items;
             
                        request.parameters.push({
                            type: "filter",
                            value: newFilter
                        });
                    }
                    return await next?.handle(request);
                }
            } 

BUT when the "Lookup view" = "Selection window" , this code does not work because 
crt.LoadDataRequest is not triggered.

Can anyone help pleas ?

Like 0

Like

1 comments
Best reply

A lookup that uses the dialog can trigger both the "crt.LoadDataRequest" for when a user types into the field and a "crt.OpenSelectionWindowRequest" (whcih used to be "crt.OpenLookupPageRequest" for versions before 8.1.3) for when it's used in dialog mode.

See the comments from Harvey on this thread for details: https://community.creatio.com/questions/crtloaddatarequest-does-not-seem-trigger

Ryan

A lookup that uses the dialog can trigger both the "crt.LoadDataRequest" for when a user types into the field and a "crt.OpenSelectionWindowRequest" (whcih used to be "crt.OpenLookupPageRequest" for versions before 8.1.3) for when it's used in dialog mode.

See the comments from Harvey on this thread for details: https://community.creatio.com/questions/crtloaddatarequest-does-not-seem-trigger

Ryan

Show all comments