Qlik Community

Qlik Sense Integration, Extensions, & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

Announcements
Qlik® Product Spotlight: Discover what’s possible. Get more from our products.
See for yourself. Register today.
datawizards1234
New Contributor

Access extension properties panel values dynamically

Hello

I'm building an extension in which settings I need to insert xrfkey to communicate with the server. My problem is that I would like to generate a dropdown list with reload tasks but to do that I need to send a request to that server containing that xrfkey previously entered by user. How can I achieve building that list dynamically based on provided parameters instead of hardcoding it as  in below file with properties panel code? Also attached screenshot of I would like to achieve dynamically

 

define([], function () {
    'use strict'

    return {
        type: "items",
        component: "accordion",
        items: {
            extensionSettings: {
                type: "items",
                label: "Extension Settings",
                items: {
                    xrfkey: {
                        ref: "props.xrfkey",
                        label: "Qlik Sense Xrfkey",
                        type: "string"
                    },
                    tasksDropdown: {
                        type: "string",
                        component: "dropdown",
                        label: "Task",
                        ref: "props.taskId",
                        options: function () {
                            return $.ajax({
                                type: "GET",
                                url: "https://serveraddress/hdr/qrs/task/full?Xrfkey=abcdefghijklmnop",
                                headers: {
                                    "X-Qlik-Xrfkey": "abcdefghijklmnop",
                                    "hdr-usr": "domain\\username"
                                }
                            }).then(function (response) {
                                return response.map(function (item) {
                                    return {
                                        value: item.id,
                                        label: item.name
                                    }
                                })
                            })
                        },
                        defaultValue: ""
                    }
                }
            }
        }
    }
})
1 Reply
Highlighted
erik_wetterberg
Honored Contributor

Re: Access extension properties panel values dynamically

Try callRepository in capabilities API. It Will generade the xrfKey for you.

 

Erik Wetterberg
https://extendingqlik.upper88.com/