Skip to main content

addRecordAction(recordKey, action, isDefault?, shownInDefaultList?)

Registers an action for a record.


// Add record for this action to be available
window.CommandBar.addRecords('users', [{'label': 'Jack', 'id': 1}, {'label': 'Jill', 'id': 2}]);

// Link
window.CommandBar.addRecordAction('users', {
text: 'Open Profile',
name: 'open_profile',
template: {
type: 'link',
value: '/profile/{{}}',
operation: 'self' // how should the page open

// Callback command
window.CommandBar.addRecordAction('users', {
text: 'Message',
name: 'message',
template: {
type: 'callback',
value: "messageUser",

// Wait for addRecordAction to complete
await window.CommandBar.addRecordAction(...);

Method parameters

recordKey Required


The record key that this action will be associated with.

action Required


The action schema. This is the same as a command.

namestringA unique identifier for the action. The name must be globally unique if two actions or commands have the same name, they can overwrite each other.
textstringThe label shown to the user in Spotlight
templateobjectThe schema defining the action (what happens when executed)
headingstringThe string shown above text in Spotlight
explanationstringThe subtitle string shown under text in Spotlight
iconstringIcon to show alongside this action. Can be a URL (absolute or relative) or emoji character.
__imagestringImage to show when the record action is displayed in a grid.
celebratestringIf true, shows confetti when a user executes the action.
isDefaultbooleanWhether this record action will be the default action for the selected record. Only applicable if multiple actions are being added for a given recordKey. If this value isn't provided, the last record action added for a recordKey will be treated as the default.
shownInDefaultListbooleanWhether this record action will be also treated as a command and shown in the default list.



type"link" | "callback"The action type
valuestringFor link commands: The URL to open. For callback commands: The callbackKey.