Change the value of variables in a central location to automatically change the output wherever variables are used.
Global variables are useful for frequently used terms or snippets that may change over time.
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 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.
if (user.groups["groupname"])
Seated Member roles are seated users and Authenticated Viewer and Anonymous user types are unseated.
if (user.seated)
if (user.unseated)
Use Global Variables that vary based on page location within your site hierarchy.
var pg = string.split(page.path,"/")
This content is about {{productname}}, version {{productversion}}.
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 Expert to return results for a new variable value, make any edit on the page(s) where the variable is used and save the page.
let export = { variablename:"Value" };
Add a comma after each variable except the last variable should not have a comma at the end.
let export = { productname:"Widgets Pro", productversion:"3.0", browser:"Chrome 11" };
let export = { //Descriptive comment productversion:"3.0" };
As you are adding variables, take into consideration how the value of the variable fits within the context that you are adding it. Pay special attention to any possessive intent within the context of the variable to ensure you have cohesive sentences and 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 CXone Expert, 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: "http://support-beta.mindtouch.com", ticket: "case", tickets: "cases", // TOOLTIPS ds: { web : { pre : "web.pre(text) : xml. Insert pre-formatted text." }, xml : { format : "xml.format(doc, style) : str. Renders the XML document." }, uri : { build : "uri.build(uri, 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." } }, // SITE VARIABLES helpurl: "success.mindtouch.com", // 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"} ] } ] } };
if (user.groups["enterprise"]) { export.productname = "Mosarch Pro"; };
if (user.unseated) { export.feature = "Super Search"; } else { export.feature = "search v4.2"; }
var pg = string.split(page.path,"/"); var root = pg[0]; if (root == "Beta") { export.productversion= "4.9 beta" };