Enterprise Open source Grafana Cloud

Variables

Business Forms automatically replaces dashboard and global variables in the following elements:

  • URLs for initial and update requests
  • Header parameter values
  • Update request payloads
  • JavaScript code
  • Section names (starting from version 4.9.0)
  • Form element labels (starting from version 4.9.0)
  • Button text (starting from version 4.9.0)
Use dashboard variables in the sections, labels, and button texts.

Three types of variables are thoroughly explained in the Grafana Crash Course.

JavaScript code

js
const formIcon = context.panel.elements.find(
  (element) => element.id === "icon"
);
formIcon.value = "$IconVar";

Synchronize with dashboard variables

For information about how Business Forms works with dashboard variables, refer to this blog post.

The following video covers the same content.