Hi Creatio Community,
I am developing a client side filter for a lookup in a section page (Freedom UI). I want to reload (re-filter) the lookup when the stage of the current record is updated (when GlbReloadEntityPage message is received).
Base logic for lookup loading:
{ request: "crt.LoadDataRequest", handler: async (request, next) => { if(request.dataSourceName == "PDS_LookupCol") { request = await ModFunctions.filterAssignTo(request); } return await next?.handle(request); } }
Reload function (Re-triggered ModFunctions.filterAssignTo(request);)
{ request: "crt.HandleViewModelInitRequest", handler: async (request, next) => { request.$context.ServerMessageReceivedFunc = async function(event, message) { if (message.Header.Sender === "GlbReloadEntityPage") { await OPGlbReloadEntity.refreshScreen(request, message); ModFunctions.filterAssignTo(request); } }; Terrasoft.ServerChannel.on(Terrasoft.EventName.ON_MESSAGE, (await request.$context.ServerMessageReceivedFunc), request.$context); return next?.handle(request); } },
Filtering function
filterAssignTo: async function(request){ .... Custom logic ....... const newFilter = Object.assign({}, filter); newFilter.items = filter.items; if(request.parameters){ request.parameters.push({ type: "filter", value: newFilter }); } return request; },
Even if the function is triggered when "GlbReloadEntityPage" is called the lookup is not reloaded with the new filtering rules.
How can i reload lookup options from freedom ui client side?
Like
0 comments