Hidden Commands

If you have developed an extension to Vault Explorer, you probably noticed the HiddenCommands() function in the IExtension interface.  The theory behind this function is that your extension can overwrite a command by hiding it from the menus and providing a replacement command.  It's a good theory on paper, but does it hold up in practice?

I've written two apps that make use of this feature, with varying degrees of success. 

Recycle Bin 2.0 hides the Delete command in an attempt to force a new process.  Things didn't work out too well when I deployed this on our internal Vault.  Delete is a pretty fundamental operation.  If you are going to remove something like that, you'd better have something good as a replacement.  Unfortunately, Recycle Bin wasn't up to the challenge, and I reverted things after a few weeks.

Hyperlink Maestro hides the Copy Hyperlink command and replaces it with a better one.  This time things worked out better.  Mainly because the new function does everything the old one does and more.  So end users are not losing anything by having the extension installed.  Personally, I can't go back to the default command.  I'm hooked on Maestro.


Here are some alternatives to hiding a command:

  • Place your new command alongside the default command. 
  • Use events to work with the existing command instead of trying to hide it.

If you still want to use the hidden commands feature, here are some best practices:

  • Don't hide a function unless you can provide a superior replacement.
  • Don't override a function unless you fully understand it's functionality.  Even something that seems simple, like Delete, can have uses that you didn't consider.
  • Most functions are too cost prohibitive to override.  Copy Hyperlink was easy to do, but something like Copy Design would take months to write.


Comments

2 responses to “Hidden Commands”

  1. Matt M Avatar
    Matt M

    Doug – pretty old post, but I’m discovering something that’s also worth noting here…
    HiddenCommands() gets called very early in the process – before you have logged in. So there’s no way of using it for “runtime” turning off of commands, i.e. hide “config” commands unless you’re an admin.
    Does this sound correct?

  2. You are right that there is no runtime hiding of commands. And you can’t hide commands based on the current user’s access level.
    All Vault Explorer commands have this limitation, not just custom commands.

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading