Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Ok, here is the setup:

  • I've a Canvas App with a select in it;
  • I've a Visualforce page with a selectList element filled with the same options as the select in the Canvas App, and a canvasApp element that points to the previously mentioned Canvas App.

Now I need to be able to synchronize the contents of the selectList with the select.
From everything I've read and experimented I'm concluding that the only way to do this is by using a somewhat messy javascript. So I was just wondering if anyone out there has a better idea on how to do this.


share|improve this question
Well a sneaky way would be to pass it down to the Canvas app as a Param... – joshbirk Feb 27 '13 at 18:46
I guess that by refreshing the whole canvas app I could keep it synchronized, but what about the other way around? How do you suggest that I keep the visualforce selectList synchronized with the select inside the canvas app? ... Again, keeping it simple. – ricardomartins Mar 1 '13 at 12:26
Canvas talks to Salesforce by sending messages to the window, and then having those messages proxied back to the API's. So you would need to do it via REST somehow. Custom Apex endpoint, perhaps. – joshbirk Mar 1 '13 at 17:25

I'm going to point you here:

I've just implemented it myself with a Canvas app and it works fine.

window.addEventListener('message', receiveMessage, false);

function receiveMessage(evt)
  if (evt.origin === '')
     //Code to process message and sync select box here.
     //alert("got message: ";

Note the browser limitations here (IE won't allow a JSON object it seems):

share|improve this answer
Just what I was looking for - thanks Steven. – Bob Buzzard Dec 12 '13 at 9:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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