Hi Team,
I am passing a message from business process via script task and receiving the same in the edit page. On receiving, I am displaying a pop up message. Though it is working functionally, I am getting error attached. I have also attached script task and message receiving code.
I am able to capture the message ("PreviewEmail") and getting the pop up as well. However, I am getting the error in console after this. kindly help me on this regard.
Thanks,
Gokul
Guid CurrentUserId = Get<Guid>("CurrentUserId");
string sender = "PreviewEmail";
// Example for message
//string message = "Please check email preview to approve the lead.";
string message = JsonConvert.SerializeObject(new {
RecordId = Guid.NewGuid(), // your record Id
Name = "Please confirm the email template to approve the lead"
// some other parameters
});
// For specific user with sysAdminUnitId
IMsgChannel channel = MsgChannelManager.Instance.FindItemByUId(CurrentUserId);
if (channel != null) {
var simpleMessage = new SimpleMessage() {
Id = CurrentUserId,
Body = message,
Header = {
Sender = sender
}
};
channel.PostMessage(simpleMessage);
}
return true;
onMessageReceived: function(sender, message) {
try
{
if (message && message.Header && message.Body) {
if (message.Header.Sender === "UpdateLeadSection") {
var result = this.Ext.decode(message.Body);
if(this.get("Id") === result.RecordId)
this.reloadEntity();
}
if(message.Header.Sender === "PreviewEmail")
{
this.log("received message");
var resultMsg = this.Ext.decode(message.Body);
this.showInformationDialog(resultMsg.Name);
}
}
}catch(e)
{this.log(e);}
},