Hello Everyone,
I have a progress bar that changes its status based on approval status. However, it requires a manual page refresh to reflect the changes in the progress bar. To address this, I've added a refresh button. Now, I want this button to trigger automatically whenever the progress bar status changes. Can anyone provide guidance on how I can achieve this using a custom handler?
Currently, I've written this code with the assumption that the record is saved whenever the status changes.
{
request: "crt.SaveRecordRequest",
handler: async (request, next) => {
const schemaName = "UsrNewProductsOnboardingformpage";
const buttonId = "Button_qef55yg";
const button = request.$record.$Model[schemaName].$Buttons[buttonId];
if (button) {
button.instance.execute();
console.log("Button clicked");
} else {
console.log("Button not found");
}
return next?.handle(request);
}
}
Like
Have you tried turning on "Enable Live Data Update" for the object? Turning that on should make it refresh automatically when the data changes with no code.
See https://customerfx.com/article/automatically-refreshing-a-creatio-freed…
Alternatively, you could add code to refresh the page: https://customerfx.com/article/refreshing-reloading-page-or-list-data-o…
Ryan
Abhishek,
Hello,
Try this handler in the page (don't forget to add creatio-devkit/common to your page schema (example define("UsrTest_FormPage", /**SCHEMA_DEPS*/["@creatio-devkit/common"]/**SCHEMA_DEPS*/, function/**SCHEMA_ARGS*/(sdk)/**SCHEMA_ARGS*/ {):
{ request: "crt.ApprovalActionHandlerRequest", handler: async (request, next) => { const result = await next?.handle(request); const handlerChain = sdk.HandlerChainService.instance; await handlerChain.process({ $context: request.$context, type: 'crt.LoadDataRequest', config: { "loadType": "reload", "useLastLoadParameters": true }, "dataSourceName": "PDS" }); } }
Worked correctly in my demo.