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

setPersistentVar(varName, value)          // set global persistent variable

Description

Excerpt

Sets the specified persistent variable as a string.

Parameters

...

Parameter name

...

Type

...

Required

...

Description

...

pageId

...

Return type

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

Example 2

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

const string varName = "globalCounter"; const number value = 100; setPersistentVar(varName, value); // a number will be converted to a string
Code Block
Table plus
applyColStyleToCelltrue
heading0
columnTypess,s,s,s
multiplefalse
columnAttributesstyle="background:#e5e7ea;font-weight:bold,,style="background:#e5e7ea;font-weight:bold,
enableSortingfalse

Syntax

setPersistentVar([issue, ]varName, value)

Package

Alias

Pkg Usage

Description

Excerpt
hiddentrue
Sets the persistent var, as a string

Sets the persistent var, as a string

Parameters

Table plus
applyColStyleToCelltrue
columnTypess,s,s,s
heading0
multiplefalse
enableSortingfalse

Parameter name

Type

Required

Description

issue

String

No

the issue key

varName

String

Yes

the variable introduced via 'persistent' keyword

value

String

Yes

the value, as a string

Return Type

None

See also

Filter by label (Content by label)
showLabelsfalse
max25
showSpacefalse
cqllabel = "pssystem_conf"routine" and space = currentSpace ( )
labelsjiraarray_comment_routineroutines