This is done by using input variables. When editing the script in the “Run script” action in the automation, the left panel will be where you see and edit input variables. Click “+ Add input variable” to add one. The top part is where you choose the variable name, and the bottom part is where you choose a value from a previous action (or the trigger) to assign to that variable.
In the script, there are a couple of ways to access these input variables, but they all start with accesing input.config()
. One method is to assign them all collectively to a single helper variable, and then access them from there. For example, say that you created an input variable named “city”. At the top of your script, you could do this:
const inputVariables = input.config()
Then where you need to access the value of “city”, you would do something like this:
if (record.getCellValue("City") === inputVariables.city) {
...
}
A more abbreviated method is to directly assign all input variables to their own unique variables in one shot at the start of your script:
const {city} = input.config()
Then later you can directly use “city” like so:
if (record.getCellValue("City") === city) {
...
}