So Summer 17 brings the new Apex Metadata API. What I am trying to do is start a deployment from a Visualforce page, and then display the results on the page once the deployment has completed.

Since there is not yet a deploy status API (as noted in the above post), I can't poll the status using Javascript Remoting. My only option seems to be to use Metadata.DeployCallback.

One thought I had was to create a platform event, have the Visualforce page subscribe to it, and then publish it from the callback. There would be no need to do any polling. Except it seems that when the callback publishes an event, nothing happens. The callback is being called, the platform event works outside of the callback, DML works inside of the callback, but platform events do not seem to work inside of the callback. There are no errors in the debug log.

Which seems to leave me with creating a custom object, storing the results in it from the callback, and then polling for those results with Javascript Remoting. At that point it just seems easier to use the FF wrapper.

Any ideas?

  • So the Platform Event that you are publishing within the callback isn't occurring? I.e. any subscribers for that event aren't being notified? Jun 12, 2017 at 0:46
  • @DanielBallinger correct, the platform event trigger does not run and the subscribed visualforce page is not notified. If I publish the event from Execute Anonymous, they work as expected.
    – Jeff
    Jun 12, 2017 at 14:37
  • This is a shame, i hope this is fixed soon. Aug 19, 2017 at 18:26

1 Answer 1


This now appears to be working in Winter'18. I have confirmed through a helper library i am developing (WIP here) to make things a little less abstract and more DML-like when working with custom metadata records. Its still WIP, i will update my blog, andyinthecloud.com when its done. Meanwhile a snippet of its use is shown below, i will also be including some lightning components (you can see my streaming component here for now).

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .