Using Variables in Document Generator Template


When using the Document Generator action for cases involving 12 or more columns of types like people, lookup, or managed metadata, errors will likely occur during the document generation process due to SharePoint's limitation on the number of complex fields. In such cases, a recommendation would be to replace those 12 or more columns with text column content.

Another recommendation would be to use the Variable feature of the Action Builder to put those values into variables, and then use the variables in your document template.

In the Action Builder where you have the Generate Document action, click on Variables.
 

 
 

Add variables for as many of the complex fields as you need to come under the 12-field limit. For example, to add a variable for a Lookup column, click the + to add a new variable.
 


 

You must create a Name for the variable. It's easier to prefix the variable names with var so you can see at a glance that they are variables and not SharePoint fields.
 


 

There is also a field to enter an initial value. This is optional, as many times a variable's value will be set by a Set Variable action later in the sequence. But in our scenario, we do need to set the initial value to the value of this complex field. To do this, click on the { } to open the Expression Builder, and double-click on the Value property of the relevant field:
 

 

Continue to use the + to add as many variables as you need, to get the number of complex fields below 12.
 

 

Now, in your document template, you need to refer to these variables instead of the fields themselves. The syntax for a variable placeholder is: @Variables.YourVariableName
 

In the current example, the entry in the document template for the Application lookup field would be:

[[@Variables.varApplication]]
 

After saving the modified template and Action Builder, the Document Generation should work as expected.






 

Was this article helpful?

Can’t find what you’re looking for?

Our world-class Customer Success team is here for you.

Contact Support