cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to use the App Environment SDK in functions?

thomas_c
Dynatrace Contributor
Dynatrace Contributor

Hi Team,

I need to retrieve and use the environment's URL in a Dashboard/Notebook function.

The docs seems lacking the info on which SDK to import. I tried the following but get an error:

thomas_c_0-1682419101752.png

Could you please guide me on using that SDK?

Thanks,

Thomas

2 REPLIES 2

stefan_eggersto
Dynatrace Mentor
Dynatrace Mentor

Hi Thomas,

@dynatrace-sdk/app-environment can only be used in apps and is not available for ad-hoc functions.

As an alternative, you can use globalThis.environmentUrl to access the environment URL.

Thanks Stefan! That works great in ad-hoc functions too.

Just to close the loop, is there a way to use such globalThis properties in a dashboard's markdown tile? Just like we can do via a dashboard variable.

Featured Posts