Add default values for Javascript AdditionalScope items

Currently, when there are additional scope variables for javascript queries, there is no option to give them default values.

This means that you either have to always provide a value for it, even if the value is only needed on some use cases, or add a "var value = value ?? false" at the top of your script (where "value" is the same word as the scope argument) to faciliate an "if(value){} within the script proper.

In lieu of being able to just run a script with an undefined value, being able to give it a default value would be cleaner than the current method outlined above.

2 Likes

I like this idea, + 1

This came up in office hours this week too! I am requesting this feature internally. I'm not sure if/when we'd ship this, but I'll follow up here with any updates

1 Like

I wouldn't mind this at all, as long as the default defaults to undefined to keep backwards compatibility.... unless I'm the only one weird enough to fake Overloaded functions :laughing:, but I have some queries that do different things if they get null, undefined, an object or a string

1 Like

:grin: Yes, if this ships, it'll have to be backwards compatible

2 Likes