Forum Discussion

jeffreyl's avatar
jeffreyl
Cloud Apps
08-12-2022
Solved

Code example using Blox dropdown to select dashboards

I have been searching the web for a couple of days with no success. I need a code example using Blox dropdown to select dashboards. I have 10 regional locations, each will have a set of dashboards. I...
  • harikm007's avatar
    08-17-2022

    Hi jeffreyl ,

    Try this blox script:

    1.  Create blox using below script (replace Dasboard1 URL and Dashboard2 URL with actual URLs):

     

     

    {
        "style": {},
        "script": "",
        "title": "",
        "titleStyle": [
            {
                "display": ""
            }
        ],
        "showCarousel": true,
        "carouselAnimation": {
            "showButtons": false
        },
        "body": [
            {
                "type": "Container"
            },
            {
                "type": "ColumnSet",
                "separator": false,
                "spacing": "default",
                "columns": [
                    {
                        "type": "Column",
                        "width": "170px",
                        "items": [
                            {
                                "type": "TextBlock",
                                "size": "small",
                                "weight": "regular",
                                "wrap": true,
                                "class": "checkboxVal",
                                "text": "Choose Dasbhoard"
                            }
                        ]
                    },
                    {
                        "type": "Column",
                        "spacing": "none",
                        "width": "175px",
                        "items": [
                            {
                                "type": "Container",
                                "spacing": "none",
                                "items": [
                                    {
                                        "type": "Input.ChoiceSet",
                                        "id": "selectVal",
                                        "class": "",
                                        "displayType": "compact",
                                        "value": "",
                                        "choices": [
                                            {
                                                "title": "Dasboard1",
                                                "value": "Dasboard1 URL"
                                            },
                                            {
                                                "title": "Dashboard2",
                                                "value": "Dashboard2 URL"
                                            }
                                        ]
                                    }
                                ]
                            }
                        ]
                    },
                    {
                        "type": "Column",
                        "spacing": "none",
                        "width": "175px",
                        "items": [
                            {
                                "type": "Container",
                                "spacing": "none",
                                "items": [
                                    {
                                        "type": "ActionSet",
                                        "actions": [
                                            {
                                                "type": "openDashboardAction",
                                                "title": "Open"
                                            }
                                        ]
                                    }
                                ]
                            }
                        ]
                    }
                ]
            }
        ],
        "actions": []
    }

     

     

    2. Create an action 'openDashboardAction' with below script:

     

     

    dashboardURL = payload.data.selectVal
    window.open(dashboardURL, '_blank').focus();

     

    -Hari