Custom templating variable default value is not selected

I am using a custom type in templating in javascript grafana dashboard. Once we refresh the page no default value is selected for the custom type how to set a default value.

Here is the code

{
name: β€˜Aggregation’,
label: β€˜aggregation’,
type: β€˜custom’,
options: [
{
selected: false,
text: β€œ1”,
value: β€œ1”
},
{
selected: true,
text: β€œ10”,
value: β€œ10”
},
{
selected: false,
text: β€œ30”,
value: β€œ30”
},
{
selected: false,
text: β€œ60”,
value: β€œ60”
},
{
selected: false,
text: β€œ600”,
value: β€œ600”
},
{
selected: false,
text: β€œ1800”,
value: β€œ1800”
},
{
selected: false,
text: β€œ3600”,
value: β€œ3600”
}
],
query: β€œ1,10,30,60,600,1800,3600”,

  },

Select value, which needs to be a default in the dashboard and then just save dashboard. Save dialogue will offer an option to Save current variables:

1 Like

How to save the default value of variables in dynamic dashboard using javascript

I got it working by adding this piece of code

    current: {
      selected: true,
      text: data[0]['region_name'],
      value: data[0]['region_name']
    },

Thanks a lot @jangaraj