Good day to everyone! I’ve encountered a task where I need to update the NextSteps component. I used crt.LoadData
and crt.ChangeNextStepsStateRequest
, but they didn't produce the desired results.
After executing, the component does not update, and data is not displayed; only after a full page refresh does the Next Step appear.
Has anyone encountered a similar issue and could help with a solution? Thanks in advance!
{
request: "crt.HandleViewModelInitRequest",
handler: async function(request, next) {
this.applyMethods(request.$context);
Terrasoft.ServerChannel.on(Terrasoft.EventName.ON_MESSAGE, (await request.$context.ServerMessageReceivedFunc), request.$context);
await next.handle(request);
},
applyMethods: function(context) {
let methods = {
refreshNextStepsStates: async function(date) {
console.debug(date);
const handlerChain = sdk.HandlerChainService.instance;
await handlerChain.process({
type: 'crt.ChangeNextStepsStateRequest',
$context: context,
});
},
showWarnDialog: async function(message) {
const actionsConfig = [
{
key: "OK",
config: {
color: "warn",
caption: resources.localizableStrings.BnzShowDialogCloseBtn
}
}
];
const result = await context.executeRequest({
type: "crt.ShowDialogRequest",
$context: context,
dialogConfig: {
data: {
message: message,
actions: actionsConfig
}
}
});
},
onSubscribeWebSocket: async function(event, message) {
if (message.Header.Sender === "Banza_ApprovalAction_WebSocketSender") {
await this.handleShowWarnMessage(message);
}
},
handleShowWarnMessage: async function(message) {
const sysValuesService = new sdk.SysValuesService();
const sysValues = await sysValuesService.loadSysValues();
const caseId = context.attributes.Id;
const currentUserContactId = sysValues.userContact.value;
const msgObj = JSON.parse(message.Body);
if (msgObj && sysValues && currentUserContactId === msgObj.currentUserContactId) {
if (caseId === msgObj?.recordId) {
if (msgObj.action === "showWarnDialog") {
await this.showWarnDialog(msgObj.message);
await this.refreshNextStepsStates(msgObj?.date);
}
}
}
},
context.ServerMessageReceivedFunc = methods.onSubscribeWebSocket.bind(context);
Ext.apply(context, methods);
},
}