LLMs.txt: Complete documentation index for AI agents
Code-based custom actions

Code-based custom actions

Important

Code-based custom actions are the recommended way to add custom actions to your embed. The legacy workflows for creating, assigning, and managing custom actions through the ThoughtSpot UI and REST APIs are deprecated from ThoughtSpot Cloud 26.12.0.cl. For more information, see Custom actions deprecation.

Code-based custom actions are custom menu items that you define in your application code, using the Visual Embed SDK. You can add new actions, assign them to a target object, and place them in the menu that you want in the embedded view. You can also reuse actions across Orgs and customize them as needed.

A code-based custom action adds a menu item to one of the following UI elements in an Answer, Liveboard, visualization, or in the Spotter interface:

  • the primary menu bar (except in Spotter embedding)

  • the More options menu the more options menu

  • the contextual menu that appears when a user right-clicks on an Answer or visualization (except for Liveboard)

Implementation of custom actions through the Visual Embed SDKπŸ”—

You can add custom actions through the Visual Embed SDK in the following two ways:

Via the init function

  • Custom actions can be registered globally during SDK initialization.

  • This allows the action to be reused across multiple embedded objects.

Via individual embed functions

  • Custom actions can be defined at the time of embedding a specific component like a Liveboard (LiveboardEmbed).

  • This provides more granular control over where and how these actions are shown.

Components of a code-based custom action interfaceπŸ”—

ParameterDescription

name

String. Display name for the custom action.

id

String. Unique identifier for the action.

position

Position where the action should be rendered. Valid values include:

  • CustomActionsPosition.MENU

  • CustomActionsPosition.PRIMARY

  • CustomActionsPosition.CONTEXTMENU

target

The target object type where the action applies. Valid values include:

  • CustomActionTarget.LIVEBOARD

  • CustomActionTarget.VIZ

  • CustomActionTarget.ANSWER

  • CustomActionTarget.SPOTTER

metadataIds

Optional. Metadata-based filtering for actions. Valid values include:

  • answerIds: Array of Strings. Applicable Answer ids. Unique identifier (GUID) for the Answer.

  • liveboardIds: Array of Strings. Applicable Liveboard ids. Unique identifier (GUID) for the Liveboard.

  • vizIds: Array of Strings. Applicable Viz ids. Unique identifier (GUID) for the Visualization.

dataModelIds

Optional. Data Model-based filtering for actions. Valid values include:

  • modelIds: Array of Strings. Unique identifier (GUID) for the data Model.

  • modelColumnNames: Array of Strings. Column names, represented in the array as [modelId::columnName]. The custom action is shown only when the specified column is visible in the visualization or Answer.

    Example: modelColumnNames: ['cd252e5c-b552-49a8-821d-3eadaa049cca::state']

orgIds

Array of Strings. Restrict visibility to specific Orgs. Unique identifier (GUID) for the org(s).

groupIds

Array of Strings. Restrict visibility to specific groups. Unique identifier (GUID) for the group(s).

Note
Code-based custom actions currently do not support Object IDs.
Note

Visibility behavior for modelColumnNames

A column counts as visible only when it is actively displayed in the visualization or Answer:

  • In a table, the column must not be in the Hidden Columns list.

  • In a chart, the column must be plotted on the chart and not listed under Not Visualized.

This check applies to the primary menu bar, the More options menu, and the right-click menu.

If the same custom action also matches modelIds, answerIds, vizIds, or liveboardIds, it appears even when the specified column is hidden or not visualized.

Important

Starting from ThoughtSpot Cloud 26.12.0.cl, custom actions that use modelColumnNames appear only when the specified column is visible. In earlier releases, these actions appeared even when the column was hidden or not visualized.

Code-based custom action for LiveboardsπŸ”—

Note
Code-based custom actions for Liveboards do not return data for visualizations in their callback. To get data from a Liveboard object and its visualizations, use the POST /api/rest/2.0/metadata/liveboard/data API endpoint.

The custom action is applied to all Liveboards.

const customActions = [{
    name: 'CA1',
    id: 'ca1',
    position: CustomActionsPosition.PRIMARY,
    target: CustomActionTarget.LIVEBOARD,
}, ];

The custom action is applied to a specific Liveboard when liveboardIds is passed in metadataIds.

const customActions = [{
    name: 'CA1',
    id: 'ca1',
    position: CustomActionsPosition.PRIMARY,
    target: CustomActionTarget.LIVEBOARD,
    metadataIds: {
        liveboardIds: ['lb1-GUID']
    },
}, ];

The custom action is applied to a specific Liveboard, with restricted visibility for a group of users in a particular Org. Pass liveboardIds in metadataIds, along with groupIds and orgIds.

const customActions = [{
    name: "CA1",
    id: "ca1",
    position: CustomActionsPosition.PRIMARY,
    target: CustomActionTarget.LIVEBOARD,
    metadataIds: {
        liveboardIds: ['lb1-GUID']
    },
    groupIds: ['grp1-GUID'],
    orgIds: ['org1-GUID']
}, ];

Code-based custom action for VisualizationsπŸ”—

The custom action is applied to all Visualizations.

const customActions = [{
    name: 'CA1',
    id: 'ca1',
    position: CustomActionsPosition.PRIMARY,
    target: CustomActionTarget.VIZ,
}, ];

The custom action is applied to all visualizations on a specific Liveboard when liveboardIds is passed in metadataIds. This custom action is also visible to all new users who have access to the Liveboard.

const customActions = [{
    name: 'CA1',
    id: 'ca1',
    position: CustomActionsPosition.PRIMARY,
    target: CustomActionTarget.VIZ,
    metadataIds: {
        liveboardIds: ['lb1-GUID']
    },
}, ];

The custom action is applied to a specific visualization when vizIds is passed in metadataIds. In this example, the custom action appears on viz1 everywhere it’s pinned.

const customActions = [{
    name: 'CA1',
    id: 'ca1',
    position: CustomActionsPosition.PRIMARY,
    target: CustomActionTarget.VIZ,
    metadataIds: {
        vizIds: ['viz1-GUID']
    },
}, ];

When both liveboardIds and vizIds parameters are provided, ThoughtSpot displays a union of all visualizations associated with the specified liveboardIds and the visualizations explicitly referenced by the provided vizIds values.

In this example, Liveboard lb1 contains visualizations viz11 and viz12. Another Liveboard, lb2, contains visualizations viz21 and viz22.

  • For Liveboard lb2, a custom action will be displayed on all visualizations, since the liveboardId is present.

  • The custom action will also be shown only on the visualization with the id viz11 for Liveboard lb1.

const customActions = [{
    name: 'CA1',
    id: 'ca1',
    position: CustomActionsPosition.PRIMARY,
    target: CustomActionTarget.VIZ,
    metadataIds: {
        liveboardIds: ['lb2-GUID'],
        vizIds: ['viz21-GUID', 'viz11-GUID']
    },
}, ];

When either groupIds, orgIds, or both are provided, custom actions are displayed only on the visualizations, and only for members of the specified groups within the specified Orgs.

In this example, Liveboard lb1 contains visualizations viz11 and viz12. Another Liveboard, lb2, contains visualizations viz21 and viz22. For a user who is part of org1 and grp1,

  • ThoughtSpot displays the custom action on all visualizations of Liveboard lb2 because the liveboardId is present.

  • The custom action will also be shown for visualization viz11.

const customActions = [{
    name: 'CA1',
    id: 'ca1',
    position: CustomActionsPosition.PRIMARY,
    target: CustomActionTarget.VIZ,
    metadataIds: {
        liveboardIds: ['lb2-GUID'],
        vizIds: ['viz21-GUID', 'viz11-GUID']
    },
    groupIds: ['grp1-GUID'],
    orgIds: ['org1-GUID']
}, ];

When modelIds is passed in the dataModelIds, the custom action is shown for all visualizations which are using the columns of the specified model.

In this example:

  • The custom action will be displayed on all visualizations of Liveboard lb2, since the liveboardId is present.

  • The custom action will also be shown for all visualizations built using the column(s) of model1.

const customActions = [{
    name: 'CA1',
    id: 'ca1',
    position: CustomActionsPosition.PRIMARY,
    target: CustomActionTarget.VIZ,
    metadataIds: {
        liveboardIds: ['lb2-GUID']
    },
    dataModelIds: {
        modelIds: ['model1-GUID']
    }
}, ];

When modelColumnNames are provided, the custom action will be displayed only on visualizations in which the specified column is visible.

Note

A column is considered visible only if it is displayed in the visualization:

  • In a table, the column must not be in the Hidden Columns list.

  • In a chart, the column must be plotted on the chart, not listed under Not Visualized.

If a visualization uses the specified column but the column is hidden or not visualized, the custom action is not displayed on that visualization.

This rule applies to all three menu positions: the primary menu bar, the More options menu, and the right-click menu.

The visibility check applies only to the modelColumnNames condition. If the same custom action also matches on another condition, such as modelIds, answerIds, vizIds, or liveboardIds, it is displayed even when the specified column is hidden or not visualized.

Important

Starting from ThoughtSpot Cloud 26.12.0.cl, custom actions that use modelColumnNames are shown only when the specified column is visible. This changes how existing custom actions behave. In earlier releases, these custom actions were shown even when the column was hidden from the table or not visualized on the chart.

In this example:

  • The custom action will be displayed on all visualizations of Liveboard lb2, since the liveboardId is present.

  • The custom action will be displayed on all visualizations built using the column(s) of model1.

  • The custom action will also be shown on all visualizations in which col1 of model2 is visible. It is not shown on a visualization where col1 is hidden from the table or is not visualized on the chart.

const customActions = [{
    name: 'CA1',
    id: 'ca1',
    position: CustomActionsPosition.PRIMARY,
    target: CustomActionTarget.VIZ,
    metadataIds: {
        liveboardIds: ['lb2-GUID']
    },
    dataModelIds: {
        modelIds: ['model1-GUID'],
        modelColumnNames: ['model2-GUID::col1-column-name']
    },
}, ];

In this example:

  • The custom action will be displayed on all visualizations of Liveboard lb2, since the liveboardId is present.

  • If model1 has col1 and col2, and model2 has col2, the custom action is shown for visualizations or Answers in which col2 of model1 is visible. It is not shown if col2 is hidden from the table or is not visualized on the chart.

const customActions = [{
    name: 'CA1',
    id: 'ca1',
    position: CustomActionsPosition.PRIMARY,
    target: CustomActionTarget.VIZ,
    metadataIds: {
        liveboardIds: ['lb2-GUID']
    },
    dataModelIds: {
        modelColumnNames: ['model1-GUID::col2-column-name']
    },
}, ];

Code-based custom action for AnswersπŸ”—

The custom action is applied to all Answers.

const customActions = [{
    name: 'CA1',
    id: 'ca1',
    position: CustomActionsPosition.PRIMARY,
    target: CustomActionTarget.ANSWER,
}, ];

The custom action is applied to a specific Answer when answerIds is passed in metadataIds.

const customActions = [{
    name: 'CA1',
    id: 'ca1',
    position: CustomActionsPosition.PRIMARY,
    target: CustomActionTarget.ANSWER,
    metadataIds: {
        answerIds: ['ans1-GUID']
    },
}, ];

When a modelIds is specified, the custom action will be displayed for all answers which use the specified model.

In this example:

  • The custom action will be displayed for ans1, since the answerId is present.

  • The custom action will also be shown for all answers using model1.

const customActions = [{
    name: "CA1",
    id: 'ca1',
    position: CustomActionsPosition.PRIMARY,
    target: CustomActionTarget.ANSWER,
    metadataIds: {
        answerIds: ['ans1-GUID']
    },
    dataModelIds: {
        modelIds: ['model1-GUID']
    },
}, ];

When modelColumnNames is specified, the custom action appears only on Answers in which the specified column is visible. If the column is in the Hidden Columns list of a table, or listed under Not Visualized on a chart, the custom action is not displayed.

This rule covers the primary menu bar, the More options menu, and the right-click menu. It does not apply if the custom action also matches modelIds, answerIds, vizIds, or liveboardIds.

In this example:

  • The custom action will be displayed for ans1, since the answerId is present.

  • The custom action will be displayed on all answers built using the column(s) of model1.

  • The custom action will also be shown for all answers in which col1 from model2 is visible.

const customActions = [{
    name: "CA1",
    id: 'ca1',
    position: CustomActionsPosition.PRIMARY,
    target: CustomActionTarget.ANSWER,
    metadataIds: {
        answerIds: ['ans1-GUID']
    },
    dataModelIds: {
        modelIds: ['model1-GUID'],
        modelColumnNames: ['model2-GUID::col1-column-name']
    },
}, ];

When either groupIds, orgIds, or both are provided, custom actions will be displayed only for the members of the specified groups within the specified Orgs, on the answers with the given answerId.

In this example, the custom action will be displayed on ans1 for users who are a part of org1, and also a member of grp1.

const customActions = [{
    name: 'CA1',
    id: 'ca1',
    position: CustomActionsPosition.PRIMARY,
    target: CustomActionTarget.ANSWER,
    metadataIds: {
        answerIds: ['ans1-GUID'],
    },
    groupIds: ['grp1-GUID'],
    orgIds: ['org1-GUID'],
}, ];

Code-based custom action for SpotterπŸ”—

Note
modelColumnNames is not supported for code-based custom actions for Spotter. Use modelIds instead.

When a modelIds is specified, custom actions will be displayed on all answers and visualizations generated from that model, as well as in any Liveboard where these answers have been pinned.

const customActions = [{
    name: 'CA1',
    id: 'ca1',
    position: CustomActionsPosition.MENU,
    target: CustomActionTarget.SPOTTER,
    dataModelIds: {
        modelIds: ['model1-GUID']
    },
}, ];

When either groupIds, orgIds, or both are provided, custom actions will be displayed on all answers and visualizations generated from that model, as well as in any Liveboard where these answers have been pinned. This will be shown only for the members with the specified groups within the specified Orgs.

In this example, for a user who is part of org1 and grp1,

  • The custom action will be displayed for answers and visualizations generated from model1.

  • The custom action will also be shown in any Liveboard where these answers have been pinned.

const customActions = [{
    name: 'CA1',
    id: 'ca1',
    position: CustomActionsPosition.MENU,
    target: CustomActionTarget.SPOTTER,
    dataModelIds: {
        modelIds: ['model1-GUID']
    },
    groupIds: ['grp1-GUID'],
    orgIds: ['org1-GUID']
}, ];

Adding callback to a code-based custom actionπŸ”—

To add an event handler to listen to the callback event and trigger a data payload as a response when a user clicks on the code-based custom action, use the Visual Embed SDK’s .on method with EmbedEvent.CustomAction.

embed.on(EmbedEvent.CustomAction, (payload) => {
    if (payload.data.id === 'your-custom-action-id') {
        // Your callback logic
        console.log("Custom Action event:", payload.data);
    }
});
Note

Ensure you have defined the custom action and noted its id. In your callback, verify the action id in the payload.

For examples of the data that ThoughtSpot sends in the payload, see Callback response payload. For information about parsing the payload and processing large datasets, see Parse JSON response payload.

Β© 2026 ThoughtSpot Inc. All Rights Reserved.