1

When trying publish custom event using Sfdc.canvas.controller.publish system is complaining publish of undefined.

Any help.

  • I was able to make publish message by deactivating Locker Service and I also found out that similar to this Live Agent issue(salesforce.stackexchange.com/questions/140139/…) we would need fix from Salesforce for canvas as well. @doug-chasman – Sandeep Dec 29 '16 at 2:18
0

The underlying cause of this issue is usage of expandos in the canvas library. The fix for this is tracked under W-3553004. In /canvas/sdk/js/36.0/controller.js

(function(global) {
var module = function() {
function subscribe(event) {
  Sfdc.canvas.parent.subscribe(event)
}
function unsubscribe(event) {
  Sfdc.canvas.parent.unsubscribe(event)
}
function publish(event) {
  Sfdc.canvas.parent.publish(event)
}
function resize(size, target) {
  Sfdc.canvas.parent.resize(size, target)
}
return{subscribe:subscribe, unsubscribe:unsubscribe, publish:publish, resize:resize}
}();
global.Sfdc = global.Sfdc || {};
global.Sfdc.canvas = global.Sfdc.canvas || {};
global.Sfdc.canvas.controller = module
})(this);

The controller.js code adds an expando called "Sfdc" on global(aka window). Now global.Sfdc ends up being a SecureObject. In the very next line, it tries to set global.Sfdc.canvas and fails silently with this error message "Uncaught TypeError: Cannot assign to read only property 'canvas' of object '[object Object]'"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.