Hi,
I'm trying to pass message between agent desktop and Cases in agent desktop section through sand box.I created message, published the message in agent desktop (OperatorSingleWindowPage) I can't able to subscribe the message in case (Queuepage)
Code in OperatorSingleWindowPage
onAutomaticButtonClick: function() {
var result = "Hello";
//window.alert(result);
//this.sandbox.registerMessages(this.messages);
this.sandbox.publish("SetButton", result, [this.sandbox.id]);
},
Code in QueuePage
subscribeSandboxEvents: function() {
this.callParent(arguments);
this.sandbox.subscribe("SetButton", function(result) {
window.alert(result);
}, this, this.getModuleId());
}
Like
Dear Akshaya,
The issue happens due to the different values in the tags. Please see the screenshots below:
In order to resolve the issue please change the value of the tags in the “OperatorSingleWindowPage” schema so that it would be equal to the value of the tags in the “QueuePage” schema. Please see an example of the code below:
-OperatorSingleWindowPage
onAutomaticButtonClick : function(){
var result = "Hello";
this.sandbox.publish("SetButton", result, [this.sandbox.id + "SingleWindow_OperatorQueuesModule_QueueModule_module_undefined"]);
}
-QueuePage
init: function() {
this.callParent(arguments);
this.sandbox.subscribe("SetButton", function(result) {
window.alert(result);
}, this, [this.getModuleId()]);
}
Please find more information in the article by the link below:
https://academy.creatio.com/documents/technic-sdk/7-15/module-message-exchange
Best regards,
Norton
Thanks Norton. I used the way given below, Now its working.
this.sandbox.publish("MessageWithResult", arg, ["resultTag"]);
How to identify the tag ?
onAutomaticButtonClick : function(){
var result = "Hello";
this.sandbox.publish("SetButton", result, [this.sandbox.id + "SingleWindow_OperatorQueuesModule_QueueModule_module_undefined"]);
}
Akshaya Gajendran,
Hello,
To understand how to get the correct tag, you should just put a breakpoint in the code where you are publishing\subscribing the message and check what is inside this.sandbox.id.
Your module will have the same base part with main page and then module name. In this case it was 'SingleWindow_OperatorQueuesModule_QueueModule_module_undefined' as module name. So in your main page you should concatenate module name and base sandbox id.
Regards,
Dmytro