Using commands, the end user can interact with the snap-in through any defined surface. Under the commands section of the snap-in manifest, commands are defined. For example, you can define a command called close that moves an issue and its children to the completed state as follows:

1commands:
2 - name: close
3 namespace: devrev
4 description: Closes the issue and all of its children issues.
5 surfaces:
6 - surface: discussions
7 object_types:
8 - issue
9 usage_hint: "[text]"
10 function: close_issue

The description of the command’s fields is as follows:

  • name: This is the name of the command used by the user to trigger it.
  • namespace: it’s used to distinguish commands installed from different snap-ins with the same name. Ensure the namespace is appropriate for your snap-in.
  • description: Displayed when a list of commands is displayed to the user.
  • usage_hint: A hint showing how to pass parameters to a command.
  • function: When the command is executed, this function is triggered by the snap-in.
  • surfaces: The surface where the command is enabled. More details in below table:
SurfaceObject typesRemarks
discussionsissueEnable command on the Discussions tab of issues
ticketEnable command on the Discussions tab of tickets
conversationEnable command on the Discussions tab of conversations
partEnable command on the Discussions tab of parts
workspacesEnable command on the Discussions tab of workspaces
rev_userEnable command on the Discussions tab of rev_users
accountEnable command on the Discussions tab of accounts
snap-inEnable command on the Discussions tab of snap_ins
opportunityEnable command on the Discussions tab of opportunity