Optional Tenant Variables

I am looking for some advice on how to create an optional tenant variable specific to a project. I noticed when we create a project template variable, the tenant has to have a value entered in the field for any thing to work. The work-around would be to fill in some value like known default value such as “None” but I was hoping there might be another way to address this. Ideally I would like to only force the new tenant parameter based on a tenant-level checkbox to opt-in.

Hi @dgschmitz!

Thanks for reaching out, and for the great question. You’re correct that you can work around this with a basic string as the default value, a better option, if you want a blank value would be to use an Octostache statement that will always default to a blank value. If you use #{if DummyVariable}never_true#{/if} as your default value, it will be blank if you don’t specify one for the tenant.

I hope this helps, and please let me know if you have any further questions.

Interesting. I did notice when I used that as the project template default value it does show up in the the tenant’s project variables and might be a little confusing to the user. Is there an advantage of using the Octostache statement over just putting in something more intuitive such as “None”?

Mostly if you want a blank value (using the Octostache string) vs. a placeholder value (the static string).

If you have the latter, you may get unwanted static values in your replaced output. Mostly just depends on the how you’re using the output in your process.