Skip to content

Check variable value with run a script #33

Closed Answered by ddwightx
sorvict asked this question in Q&A
Discussion options

You must be logged in to vote

You don't actually need a Script to do this. You could just use the built-in Rule operations.

However, if you rather use a Then Run Script script, it would look like this:

const variableValue = Reshaper.variables.getGlobalVariable("nameOfTheVariable");
if (variableValue && !variableValue.includes("@")) {
  Reshaper.variables.setGlobalVariable("nameOfTheVariable", "");
}

The above assumes you are using a global variable. However if you are using an event variable, you would use getEventVariable and setEventVariable instead of getGlobalVariable and setGlobalVariable.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@sorvict
Comment options

Answer selected by sorvict
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants