All Collections
Automation
Functions
Functions IncrementGlobalParam(), DecrementGlobalParam()
Functions IncrementGlobalParam(), DecrementGlobalParam()

Increment and decrement global parameters in a thread-safe way

Sergey Shurygin avatar
Written by Sergey Shurygin
Updated over a week ago

Use IncrementGlobalParam() and DecrementGlobalParam() to increment and decrement, respectively, an integer global parameter previosly created using SetGlobalParam() in a thread-safe way (as an "atomic" transaction).

For example, if you need to count how many times a workflow has been executed since a certain moment, you'll need to use these IncrementGlobalParam("myCounter"), because workflow sessions for different records may execute in parallel, so code like
SetGlobalParam("myCounter", GetGlobalParam("myCounter")+1)

would not work.

How to use

Use the function in any of the following ways:

IncrementGlobalParam(name[, step=1])

DecrementGlobalParam(name[, step=1])

Input

  • name: the name of the global parameter (key) to increment or decrement.

  • step (optional, integer): the value by which to increment or decrement the name parameter.

Output

None.

Examples

IncrementGlobalParam("myParam")

IncrementGlobalParam("myParam", 100)

See also

Did this answer your question?