Skip to content

Commit 6365eb4

Browse files
authored
Merge pull request #375 from thoughtspot/CBCA-updates
CBCA updates
2 parents f050f7b + 64ff432 commit 6365eb4

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

modules/ROOT/pages/code-based-custom-actions.adoc

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ Custom Actions can be embedded through the Visual Embed SDK in the following two
6969

7070
=== Code based custom action for Liveboards
7171

72+
[NOTE]
73+
Code based custom action 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.
74+
7275
The custom action is applied to all Liveboards.
7376

7477
[source,javascript]
@@ -206,6 +209,8 @@ const customActions = [{
206209
}, ];
207210
----
208211

212+
213+
////
209214
When the answerId parameter is provided, the system displays custom actions only on the visualization(s) that use the specified underlying answerId.
210215
211216
In this example, consider a Liveboard (lb1) with three visualizations: viz1 (based on ans1), viz2 (based on ans2), and viz3 (based on ans3).
@@ -229,6 +234,8 @@ const customActions = [{
229234
}, ];
230235
231236
----
237+
////
238+
232239

233240
When `modelIds` is passed in the `dataModelIds`, then the custom action is show for all visualization which are using the columns of the specified model.
234241

@@ -432,6 +439,9 @@ In this example, for a user who is part of org1 and grp1,
432439

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

442+
[NOTE]
443+
`modelColumnNames` are not currently supported for code based custom action for Spotter.
444+
435445
[source,javascript]
436446
----
437447
const customActions = [{
@@ -445,4 +455,21 @@ const customActions = [{
445455
groupId: ['grp1'],
446456
orgId: ['org1']
447457
}, ];
448-
----
458+
----
459+
460+
461+
=== Add callback to a code based custom action
462+
463+
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.
464+
465+
[source,javascript]
466+
----
467+
embed.on(EmbedEvent.CustomAction, (payload) => {
468+
if (payload.data.id === 'your-custom-action-id') {
469+
// Your callback logic
470+
console.log("Custom Action event:", payload.data);
471+
}
472+
});
473+
----
474+
475+
Ensure you have created the custom action and noted its id. In your callback, verify the action id in the payload.

0 commit comments

Comments
 (0)