Postponed SPEAK commands

Reading time ~2 minutes

Starting from Sitecore 8.1 Update-2, SPEAK team has improved performance while loading Experience Editor. In some cases, it might change the behaviour of current solutions. Make sure that it does not influence on your features.


When I switched to Sitecore 8.1 Update-2 rev. 160302 I encountered problems with a couple of my SPEAK commands located in the Experience Editor Ribbon.

Previously commands were executed every time when I refreshed a page, but after the update only when I switched to the tab where the commands were located.

I figured out that this is an expected behaviour and I’ve got a simple fix for that as well.

Problem cause

If you ever created anything in SPEAK you probably know how SPEAK commands look like.

There are following functions in each of them:

  • canExecute - executed to determine whether current command can be executed in a current context
  • execute - invokes page code of a command

For some reason, after the update, my commands were executed only when I switched to a specific tab, where the checkbox is located.

I dug into SPEAK pipelines and found CheckCommandCanExecute processor in InitializePageEdit pipeline.

This processor filters and selects those commands which are valid in the current context and invoke canExecute function for each.

When I compared two Sitecore versions I found some differences in implementations.

I figured out that there is an additional condition that needs to be meet:

currently active strip/tab need to match strip/tab to which a command belongs.

So that was an answer to my problems. But how to fix this?

Like I said it was done to improve a performance during Ribbon loading in Experience Editor. This is a great move but in my particular case, I could not afford to wait for somebody to switch to a specific tab.

I had to run canExecute immediately after a page was loaded.


I poked around and found something that could help me achieve my goal.

This is a new property called PostponedCall.

By default this property is empty and in this case it works the same as value True.

So canExecute function of your commands will be invoked only when you switch to a specific tab.

The trick here is to set the value of this property to False.

From now canExecute function of your command will be called on every page load.


If you have any question feel free to ask.

SXA Health Check

Scan your SXA solutions and find out if there are no problems Continue reading

SXA - create sites/tenants with SPE

Published on September 19, 2018

SXA - Blog

Published on December 14, 2017