Hi all,
I'm hoping to implement a custom click handler from a Freedom UI list view that opens a preconfigured sidebar that displays a detailed view of the record that was clicked. I've successfully been able to capture the click event, open the side panel, & fetch the Id of the active row, but have not been able to figure out how to use that data to actually display on the sidebar; it's always popping up blank. Has anyone here tried to do something similar?
Here's my current code for reference:
{
request: "crt.HandleViewModelAttributeChangeRequest",
handler: async (request, next) => {
let sidebarCode = "";
let rowId = "";
if (request.attributeName == "GridDetail_9lgj3r0_ActiveRow") {
rowId = await request.$context.GridDetail_9lgj3r0_ActiveRow;
sidebarCode = "LeadSidebar";
}
if (sidebarCode != "") {
const handlerChain = sdk.HandlerChainService.instance;
await handlerChain.process({
type: "crt.OpenSidebarRequest",
sidebarCode: sidebarCode,
$context: request.$context,
modelInitConfigs: [{
action: "edit",
recordId: rowId
}]
});
}
return next?.handle(request);
}Like
Hello Matt Ciani,
1. Refer to the following articles:
https://academy.creatio.com/docs/8.x/no-code-customization/customization-tools/ui-and-business-logic-customization/set-up-the-app/set-up-a-sidebar
https://academy.creatio.com/docs/8.x/dev/development-on-creatio-platform/platform-customization/freedom-ui/sidebar/overview#title-15102-4
Ensure that the sidebar page includes the required data source.
Refresh the data source after opening the sidebar to ensure the data is loaded correctly.
2. crt.OpenSidebarRequest does not support the modelInitConfigs array or other page parameters. Also, you cannot affect the sidebar page from the other page; they have different contexts. As a workaround, you can try using the browser’s native BroadcastChannel API to pass the record ID - see this thread: https://community.creatio.com/questions/open-custom-freedom-ui-page-custom-button-opportunity-edit-page-and-pass-opportunity