Global Array Variable that can be accessed and modifed inside a journey

Hello People, Can you suggest me on how can I have a global array variable that can be accessed and modified inside any functions within a journey ? If its possible, Can you tell me the syntax of it as well ?

Hi Amudhan,

We have Redis in-memory store available which you can use with app.memory

You can store the array as a string as follows:

let array = [1,2,3,4]
app.memory.set('anykeyname', JSON.stringify(array));

And retrieve it using JSON.parse

app.memory.get('anykeyname').then((result) => {
let array = JSON.parse(result)

For more details please visit the Documentation link here