When we deploy Power Automate flows that send emails with URLs in the body across environments, it’s never a good practice to have those URLs hardcoded in the body.
For the cases where those URLs target a Power Pages site, there are some ways we can make them dynamic per environment, you can think of environment variables but there is an even simpler way. I know this can look simple but the other day there was someone asking me about it, and the person had hardcoded the URLs with conditions in their flow
As the Website record ID for a site never changes across different environments when you deploy the same site from Dev to Test, and etc…We can use the same Website identifier in our flow (yeah I know it’s not pretty but it will be the same across environments).
We can grab the value directly from Dataverse, from the Websites table and the Website record for that environment:
Notes