I am using the message functionality to send a message from a business process to client-side code. I am passing along the current user's Id to prevent messages from interfering with random users.
Business process code.
Terrasoft.Configuration.MsgChannelUtilities.PostMessageToAll("OpportunityProductChanged", "" + UserConnection.CurrentUser.Id); return true;
Client-side code
init: function() { this.callParent(arguments); // register our function to receive messages Terrasoft.ServerChannel.on(Terrasoft.EventName.ON_MESSAGE, this.messageDelegator, this); }
messageDelegator: function(scope, message) { window.console.log("messageDelegator: 1"); // Only handle messages for this user. window.console.log(Terrasoft.SysValue.CURRENT_USER.value); window.console.log(message.Body); if (Terrasoft.SysValue.CURRENT_USER.value === message.Body) { var sender = message && message.Header.Sender; window.console.log("messageDelegator: 2"); switch(sender) { case "OpportunityProductChanged": window.console.log("messageDelegator: 3"); this.rollUpOpportunityProduct(); break; default: break; } } },
I receive the error
"You're trying to decode an invalid JSON String: 7f3b869f-34f3-4f20-ab4d-7480a5fdf647"
I never had this issue in previous versions. Currently on 7.17.0.2164
Is this a bug? Is there a new way I need to do this?
Thanks
Like
FYI I've reported this to support.
As a temporary fix (until it's fixed officially), you can do the following:
- Create a "Replacing view model"
- Select "Communication panel schema" as the parent object
- Then paste in the code below
define("CommunicationPanel", [], function() { return { methods: { processOmniChatMessage: function(message) { var sender = message.Header.Sender; if (["UnreadChatsCount","AcceptChat","NewIncomingChat","NewConversationMessage"].indexOf(sender) !== -1) { this.callParent(arguments); } } } }; });
Once Creatio adds an official fix, I'd remove this in case they add additional messages they're listening for here.
Ryan
I just noticed this with one of my marketplace add-ons today on 7.17. I've not spent a lot of time looking into it yet, but wanted to confirm that it's not just you. I hope to spend some time looking at it tomorrow to see if there were underlying changes that would break things (unless we hear back from Creatio on this before)
Ryan
The issue is in the CommunicationPanel schema in the OmnichannelMessaging package. In the processOmniChatMessage it receives server messages and attempts to decode the body as JSON before it checks to see if it is the message it is looking for. Since not all messages are sent as JSON this code breaks for all messages sent from the server that are just strings. Creatio needs to change this so it first checks to see if it is the message it is looking for, and only then attempt to decode the message as JSON. I'm going to send this to support so they can escalate to development as well.
Ryan
FYI I've reported this to support.
As a temporary fix (until it's fixed officially), you can do the following:
- Create a "Replacing view model"
- Select "Communication panel schema" as the parent object
- Then paste in the code below
define("CommunicationPanel", [], function() { return { methods: { processOmniChatMessage: function(message) { var sender = message.Header.Sender; if (["UnreadChatsCount","AcceptChat","NewIncomingChat","NewConversationMessage"].indexOf(sender) !== -1) { this.callParent(arguments); } } } }; });
Once Creatio adds an official fix, I'd remove this in case they add additional messages they're listening for here.
Ryan
Hello Tyler,
Thank you for reporting the issue. We already fixed that for 7.17.1 release version but if you need to have that fixed for 7.17.0, please contact our technical support team asking to provide the fix package.
PR-19461 is the query number for this particular case, please mention it in your email.
@Ryan, thank you for your participation!
Best regards,
Bogdan S.