Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
datawizards1234
Partner - Contributor
Partner - 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
ErikWetterberg

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