Skip to main content
NICE CXone Expert
Expert Success Center

Global Variable Guidelines

Applies to:
All MindTouch Versions
Role required:
A global variable is a dynamic placeholder that you can use in MindTouch content.

Change the value of variables in a central location to automatically change the output wherever variables are used.

  • Set {var1} = Hello so wherever "{var1}" exists in your content, it displays as "Hello" when the page loads.
  • Change the value to {var1} = Good Day to change the display to "Good Day" when the page loads.

When to use Global Variables

Global variables are useful for frequently used terms or snippets that may change over time.

  • Product or feature name -  A name that has not yet been approved or may change over time.
  • Version or build number - When you release a new version and some content is still relevant to the new version.
  • Copyright or expiration date - Update dates throughout content with one change.
  • Consistency - Product-related terminology, dependency information, or important details can always display the same way.

Set up global variables

  1. Navigate to Site tools > Dashboard > Site Administration > Global variables
  2. Select Edit from the MindTouch toolbar.
  3. Expand the DekiScript container to add variable names and output values.
  4. Save the page.

Special Characters

  • Variable names can include ASCII characters as well as "_" underscore and "$" dollar sign characters
  • Variable name cannot be solely comprised of an "_" underscore and "$" dollar sign character
  • In addition, variables cannot start with an integer or number (e.g., 1Variable)
  • There are no character length limits for variable names or values
  • Symbol Unicode cannot be used in DekiScript

Global Variables and DekiScript

Expert does not allow a DekiScript function as a global variable, since doing so would break any DekiScript using that function on your site. 

Conditional Global Variables

Conditional global variables provide an extra layer of flexibility and control to your variables with the ability to personalize variable values based on User Group, User Role, or Page Location.

User Group

if (user.groups["groupname"]) 

User Role

Pro Member roles are seated users and Community or Anonymous user types are unseated.

if (user.seated) 
if (user.unseated) 

Page Location

Use Global Variables that vary based on page location within your site hierarchy.

var pg = string.split(page.path,"/")

Use Global Variables in content

  1. Open any page in Edit mode.
  2. When adding content, insert a variable using double curly brackets on each side of the variable name.
    This content is about {{productname}}, version {{productversion}}.
  3. Save the page to see the variable name display as the variable value.

Changing variable values - search impact

If you update a global variable value, the new value will appear on any page where the variable is used. However, the new value it is not searchable for pages where the variable is used until the page is edited and saved to update the search index. If you need MindTouch to return results for a new variable value, make any edit on the page(s) where the variable is used and save the page.

Global Variable Examples

Single variable example

let export = {

Multiple variable example

Add a comma after each variable except the last variable should not have a comma at the end.

let export = {

    productname:"Widgets Pro",
    browser:"Chrome 11"

Optional comment example

let export = {

    //Descriptive comment

Combination example 

Make sure as you are adding variables that you take into consideration how the value of the variable fits within the context that you are adding it. Pay special attention if there is any possessive intent within the context of the variable to ensure you have cohesive sentences/content.

let export = {
   // Use the 'export' value to define global variable.
   mtproduct:"MindTouch site",
   stag: "classification",
   stags: "classifications",
   stagup: "Classification",
   stagsup: "Classifications",
   // These terms represent common types of users in MindTouch, and are used throughout Overview sections in this site.
   techwriter: "Technical Writers",
   support: "Support Agents",
   sme: "Subject Matter Experts",
   manager: "Content Managers",
   admin: "Site Owners",
   enduser: "Consumers",
   developer: "Developers",
   ticketportalURL: "",
   ticket: "case",
   tickets: "cases",
   ds: {
       web : {
           pre : "web.pre(text) : xml.  Insert pre-formatted text."
       xml : {
           format : "xml.format(doc, style) : str.  Renders the XML document."
       uri : {
           build : ", path, args) : str.  Build a new URI with path and query parameters."
       site : {
           api : "site.api : str.  Returns a string with the site's API uri."

   helpurl: "",
   // Custom Classifications
   mindtouch: {
       customTagsDefinition: [
           prefix: 'complex',
           label: 'Complexity:',
           recursive: false,
           tags: [
               {tag: "beginner", label: "Beginner"},
               {tag: "intermediate", label: "Intermediate"},
               {tag: "advanced", label: "Advanced"}
           prefix: 'version',
           label: 'Version:',
           recursive: false,
           tags: [
               {tag: "tcs", label: "MindTouch TCS"},
               {tag: "mt4", label: "MindTouch 4"},
               {tag: "both", label: "TCS and MT4"}

Condition examples

if (user.groups["enterprise"]) {
    export.productname = "Mosarch Pro";
if (user.unseated) {
    export.feature = "Super Search";
    export.feature = "search v4.2";
var pg = string.split(page.path,"/");
var root = pg[0];

if (root == "Beta") {
    export.productversion= "4.9 beta"
  • Was this article helpful?