I have a Freedom UI list where I can take a few actions after the user has selected one or more rows. The actions run as expected, but the records are kept selected after the actions run and the user has to manually clear the selection. What do I need to add to the custom code to clear the selection?
It depends on the action. The Unlock one just clears the locked by field for the selected cases. The print generates letters and sends them to our print vendor for each case selected. Finally, the Assign one opens a window where the user can select the person to assign the cases to. Each one is calling the code below with the proper parameters.
I just need to know what I need to add to that code to clear the selection after the code that runs the business process.
Thanks,
Jose
processSelectedRows: async function(request, processName, message, next) { var selectedRecords = await this.getSelectedRows(request.$context); var count = selectedRecords.count; var date = new Date(); var hours = date.getHours(); var minutes = date.getMinutes(); var ampm = hours >= 12 ? 'PM' : 'AM'; hours = hours > 12 ? hours - 12 : hours; var timeString = hours.toString().padStart(2, '0') + ':' + minutes.toString().padStart(2, '0') + " " + ampm; message = message + " on " + timeString + " for " + count + " selected records."; request.$context.executeRequest({ type: "crt.NotificationRequest", message:message }); const handlerChain = sdk.HandlerChainService.instance; result = await handlerChain.process({ type: 'crt.RunBusinessProcessRequest', processName: processName, processRunType: "RegardlessOfThePage", processParameters: { "SelectedRecords": selectedRecords.selected }, $context: request.$context }); if (!result.success) { var errorMsg = Ext.String.format(resources.localizableStrings.UnableToProcessSelectedRows, processName, result.errorInfo?.message); request.$context.executeRequest({ type: "crt.NotificationRequest", message: errorMsg }); } /* Call the next handler if it exists and return its result. */ return next?.handle(request); }
Thanks Ryan. I tried that (and other variations like setting the type to 'clear') and the model gets cleared, but the GUI is not refreshed. In other worlds on the page the records are still showing as selected even though the model now has cleared the selection.