setState Method

Use the setState method to dynamically set the state on an Aura component for CRM Analytics dashboards, or interact with the dashboard by dynamically changing the selection.

Argument NameDescription
configThe configuration for the setState call. This value is a JSON object that sets parameters for the call.

For setState, the config parameters are:

state

Required; the dashboard state to use for update.

pageId

Required; the dashboard page ID to update.

replaceState

Optional; indicates whether to replace the dashboard state (true) or not (false). The default value is false.

When the replaceState parameter is false or not passed, only filters and step selections explicitly passed in the state parameter are updated. Any other state changes made since the dashboard was loaded are still present. When replaceState is true, the dashboard is reset with the provided external state, clearing any other selections made since the dashboard was loaded.

Add your implementation of the setState call into the controller.js for your Aura component. The config JSON is created with the required pageId and state attributes and the optional replaceState attribute.

The state can be set dynamically from user input or from another dashboard’s state. For the complete dashboard state structure, refer to the Analytics Dashboard JSON Reference guide.

See Also