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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out 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
Master
Master

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