Sidebar

What is the use for Channel Script Variables?

0 votes
260 views
asked Sep 13, 2022 by william-g-1659 (140 points)
Are their values retained outside of the indiviual message, i.e. could be used to count certain messages based on other parameters?

1 Answer

0 votes
Channel Script Variables are useful for storing information that needs to be accessed by other functions.  Think of them sort of like global variables.  For example, if you needed to store the results of a query for use in multiple functions, or perhaps the response from an API call that more than one function needs to use.  You could store that information in a Channel Script Variable.  

Channel Script Variables can have two different scopes - message, and channel.  Message scoped variables exist for the life of the message, but cannot be used by other messages (i.e. they are reset once the message is processed).  Channel scope variables exist for as long as the channel is running; once the channel is stopped or restarted, they get reset.

Here's another KB that has some information on Script Variables:

https://www.qvera.com/kb/index.php/1680/there-way-cache-create-object-variables-mapping-functions?show=1680#q1680
answered Sep 13, 2022 by jon-t-7005 (7,590 points)
...