Skip to main content

addMetadata(key, value, addToUserProperties?)

Adds metadata to CommandBar.


window.CommandBar.addMetadata("userIsWorkspaceOwner", true);

Method parameters

key Required


The key for the metadata. Used to reference it in other places, e.g., Command Rules.

value Required


There are two options:

  • Value: A literal value (e.g. true)
  • Dynamic: A function to load a value for key, used to lazily load a metadata value. Dynamic values are refreshed on page load and on Bar open.

In general, you should always use static loading where possible. Note that with dynamic loading, metadata won't always be available to control shortcut availability, since loader functions aren't called when a shortcut is run. When using shortcuts, we highly recommend using only static values.

addToUserProperties Deprecated

Deprecated. See setUserProperties.