Qlik Community

QlikView Integrations

Discussion Board for collaboration on QlikView Integration.

Join “Do More With Qlik” with Mike Tarallo to get a first-hand look at the New Authoring Experience, June 29th: REGISTER HERE
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Document Extension access Definition.xml Variable

I am trying to access a variable that I have added to the Definition.xml file through a document extension. I have seen a bunch of examples for Object Extensions but that is not what I need. I've attached an example Extension.

The highlights:


Qva.AddDocumentExtension(EXTENSION_NAME, function () {

  var doc = Qv.GetCurrentDocument();

  if(doc) {

       var testVar;

       doc.GetAllVariables(function(vars) {

            for(var i = 0, len = vars.length; i < len; i++) {

                 if(vars.name === "TestValue") {

                      testVar = vars.value;


                 if(testVar) {











<?xml version="1.0" encoding="utf-8"?>

<ExtensionObject Label="ExampleExtension" Path="ExampleExtension" Description="" Type="document">

<Text Label="TestValue" Initial="" Expression="=OsUser()" />


the document doesn't have a Layout object that I could find to get the variable from the Definition.xml like done in Object Extensions so I'm not sure how else to get the variable with label "TestValue" if not through the GetAllVariables function.

3 Replies

You would access it by setting your javascript variable = this.Layout.Text0.text.


var test = this.Layout.Text0.text;

Not applicable

this.Layout doesn't exist for me at any point in the extension. That works fine for Object Extensions but haven't been able to accomplish that with a Document Extension.


What are you trying to do with the variable in the document extension?  Document extensions don't work like object extensions where you have the properties window for someone to put something in the text field, so there is probably a different way you need to go about doing whatever you're trying to do.

If you're trying to allow the developer of the document to choose some kind of option, they could do so by making a variable in the document and then you could pull that into your document extension.  A good example of how this can be done is the AutoRefresh extension by swr‌‌:AutoRefresh Document Extension