Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

...

...

...

...

...

...

...

...

...


Info
titleAvailability

This routine is available starting with Power Scripts™ for Confluence v1.1.0.

Syntax

setPersistentVar(pageId, varName, value)  // set page persistent variable

...

boolean (true/false)
Returns true if persistent variable value was set successfully, returns false otherwise.

Examples

Example 1

This example assigns value 0 to a page persistent variable named "pageViews". If the variable doesn't exist it will be created.

Code Block
const string varName = "pageViews";
const number pageId = getPage("TEST", "Example Page");
setPersistentVar(pageId, varName, 0);    // a number will be converted to a string

...

This example assigns value 100 to a global persistent variable named "globalCounter". If the variable doesn't exist it will be created.

Code Block
const string varName = "globalCounter";
const number value = 100;
setPersistentVar(varName, value);    // a number will be converted to a string

...