Skip to main content

system.mes.dashboard.saveWidgetAndParameters

Description

Saves or updates a Dashboard Widget and its associated parameters in a single call. Parameters provided are saved/updated; parameters not included are removed from the widget.

Syntax

system.mes.dashboard.saveWidgetAndParameters(widget, parameters)

Parameters

ParameterTypeNullableDescription
widgetJSON ObjectFalseThe widget to save (same structure as saveWidget).
parametersList<JSON Object>FalseList of parameter DTOs to associate with the widget.

Returns

Returns a JSON representation of the saved widget.

Code Examples

widget = system.mes.dashboard.newWidget()
widget['name'] = 'Time Series'
widget['viewPath'] = 'Mes/Widgets/TimeSeries'

p1 = system.mes.dashboard.newWidgetParameter()
p1['name'] = 'Chart Title'
p1['parameterKey'] = 'title'

saved = system.mes.dashboard.saveWidgetAndParameters(widget, [p1])
print(saved)