Blox action initiating the elasticube build for Sisense on Linux
This article explains how to create a Blox action to programmatically initiate an Elasticube build on Sisense running on Linux. The action uses Sisense’s REST API and can be triggered from dashboards via a button. Applicable for Sisense version 2024.x and above, on both cloud and on-premises environments.
Step-by-Step Guide:
Prerequisites:
- Blox is enabled in your Sisense instance
- You have access to edit dashboards and create actions
- You know the UUID (datamodelId) of the model you want to build
1. Add a Blox widget to your dashboard
To define and register a custom action, you must first create a Blox widget in a dashboard.
- Open your dashboard
- Click + Add Widget → Blox
- In the widget editor, add the following minimal configuration:
{ "style": "", "script": "", "title": "", "showCarousel": true, "body": [], "actions": [] }
- Click Apply to save the widget.
2. Create the custom action from the widget editor
Now that the Blox widget is added, follow these steps to define the custom action:
- Click the pencil/edit icon on the Blox widget
- Go to the Actions tab
- Click the three-dot menu (⋮) in the top-right corner of the Actions tab
- Select “Create Action”
This opens the action editor.
3. Define the buildCube action
Step 1: Set the action name and paste the code
- Action name: buildCube
- Language: JavaScript
- Paste the following code:
// JavaScript (Blox Action)
const datamodelId = payload.data.datamodelId;
const buildType = payload.data.buildType || "full";
const schemaOrigin = payload.data.schemaOrigin || "latest";
const rowLimit = payload.data.rowLimit != null ? payload.data.rowLimit : 0;
const $internalHttp = prism.$injector.has("base.factories.internalHttp") ?
prism.$injector.get("base.factories.internalHttp") : null;
const ajaxConfig = {
url: "/api/v2/builds",
method: "POST",
contentType: "application/json",
accept: "*/*",
headers: {
"internal": "true"
},
data: JSON.stringify({
datamodelId: datamodelId,
buildType: buildType,
schemaOrigin: schemaOrigin,
rowLimit: rowLimit
}),
async: false
};
const httpPromise = $internalHttp ?
$internalHttp(ajaxConfig, true) :
$.ajax(ajaxConfig);
if (httpPromise && httpPromise.then) {
httpPromise
.then(response => {
console.log("Build task created successfully:", response);
})
.catch(error => {
console.error("Failed to create build task:", error);
});
} else {
console.error("HTTP request failed to initiate.");
}
Step 2: Define the action template
In the Template tab of the same modal, paste the following JSON:
{
"type": "buildCube",
"title": "title",
"data": {
"datamodelId": "datamodelId",
"buildType": "buildType",
"schemaOrigin": "schemaOrigin",
"rowLimit": "0"
}
}
Click Save to register the action.
4. Use the action from a Blox widget
After defining the action, you can call it from a widget using this configuration:
{
"style": "",
"script": "",
"title": "",
"showCarousel": true,
"body": [],
"actions": [
{
"type": "buildCube",
"title": "Build",
"data": {
"datamodelId": "8800cc3d-b12f-4fe9-962a-c0c2ff8f7e85"
}
}
]
}
This will display a “Build” button. When clicked, it triggers the buildCube action for the given model. You can extend the data block with:
-
"buildType" — full, schema_changes, by_table, publish
-
"schemaOrigin" — latest or running (for extract models)
-
"rowLimit" — a row limit integer (default: 0)
Conclusion:
To trigger Elasticube builds in Sisense on Linux, you can define a reusable Blox action (buildCube) and call it from dashboards. This method simplifies model maintenance and enables users to initiate builds on demand, without needing direct access to the Data page or backend.
References/Related Content
Sisense REST API endpoint documentation
Sisense BloX Custom Actions Guide
Disclaimer: This post outlines a potential custom workaround for a specific use case or provides instructions regarding a specific task. The solution may not work in all scenarios or Sisense versions, so we strongly recommend testing it in your environment before deployment. If you require additional assistance with this, please don't hesitate to let us know.