I have a Blueprint widget where I would like to call an analysis when a header button is clicked.
My analysis looks for a deviceID as follows:
async function runAnalysis(context, scope) {
const deviceID = scope[0]?.device;
if (!deviceID) {
return context.log("Error: Could not find a device ID in the trigger scope.");
}
When I call the script via the widget header button, I get the following:
[2025-10-19 19:48:30] Error: Could not find a device ID in the trigger scope.
However, if I use a dedicated Push Button widget to call the same analysis, it works just fine.
Before proceeding, what is your intention and objective for triggering the analysis through the Button Header? Understanding the desired flow will help determine the correct implementation.
Regarding the error: when analysis is triggered directly via the Button Header, the scope parameter is sent as an empty object. As a result, the payload does not include the device field, which leads to the device-related error you’re seeing.
Our intention on a button click is to kick off an analysis which makes an HTTP call to an external API endpoint. The deviceID is needed so that the API call can be directed to the same device that is associated with the blueprint widget.
@info1 if you’re using a Table widget, you can enable the “Show control column” option and use Custom Buttons.
With this setup, every time a button is pressed, it will trigger the analysis and the scope parameter will include the device associated with that row — allowing you to access the device field as expected.
Alternatively, if you prefer to keep using the Header Button, you can change its action from triggering the analysis directly to Open widget.
Then, open an Input Form widget that includes a Device Selector field. This way, the user can select which device to target, and the analysis will receive the selected device information to send the HTTP command accordingly.
In our application, all widgets displayed on our blueprint dashboard tab are associated with one and only one device. A different device can selected via a pull-down selector. We don’t use tables to select devices.
In this specific case, we’d like to add a header button to the Cylinder blueprint widget. Since this widget is already associated with one specific device, is it possible to update the widget button scope to pass along the deviceID to the analysis script? We’d like to avoid opening up a separate form to do so (that would be a cumbersome UX).
@info1 thanks for the context. Currently, when an Analysis is triggered directly from a Header Button, the scope parameter is sent as an empty object, so the device field isn’t available.
Adding device context, including full support for dynamic Blueprint Dashboards, is already on our roadmap as part of an upcoming usability improvement.
As a temporary workaround, you can hardcode a scope using the engine icon either in the Header Button or in the Analysis configuration, which works for static scenarios.