Is it possible to make the domain in the url of a `link` parameter dynamic, based on the user's instance environment (i.e. prod, dev, etc. )?

Knowledge Drop

Last tested: Oct 25, 2019
 

Simple Case

In the url of a link parameter, you can omit the instance name and Looker will fill in the instance name with the instance you're on when you click the link. So you can just use /dashboards/123 .

User Attribute Workaround

If you want something dynamic that isn't just the current instance name, we can use a clever workaround.

There is no liquid variable that can make the domain of a link dynamic, but you can workaround this by creating a user_attribute with the same name on each instance, but assigning it different default values. You will not assign this user attribute to anyone, but always use the default value. In the link parameter, you will hardcode the default value of the user attribute for each instance, like this:

https://{{ _user_attributes['instance_hostname'] }}/dashboards/123

This content is subject to limited support.                

Version history
Last update:
‎04-05-2021 09:01 AM
Updated by: