Hello,
I need to create a custom handler for a button. It is necessary that after the button is clicked, two actions are performed sequentially: first, the record should be saved, and then a process should be triggered. My code isn't working. Could you please help?
handlers: /**SCHEMA_HANDLERS*/[
{
request: "crt.CustomHandler",
handler: async (request, next) => {
const result = await next?.handle(request);
const handlerChain = sdk.HandlerChainService.instance;
// Спочатку зберігаємо дані
await handlerChain.process({
type: 'crt.SaveRecordRequest',
$context: request.$context,
dataSourceName: "PDS"
});
// Потім викликаємо процес
await handlerChain.process({
type: 'crt.RunBusinessProcessRequest',
$context: request.$context,
processName: "srProcess_5c65949",
processRunType: "ForTheSelectedPage",
showNotification: true,
recordIdProcessParameterName: "ID"
});
return result;
}
}
]/**SCHEMA_HANDLERS*/,