Hi @Ric835
As there is no easy way that I am aware of that allows you to determine the environment that your Flow is running in I have created a scope that does this check and sets a variable which can then be used in conditions. For example, you may want to send email alerts to your users in Live but for development testing these emails should go to a specific mailbox that can be monitored for issues.
As a prerequisite for this approach you must have a Common Data Service connection available and separate environments set up for Live/UAT/Development. In order to implement this there is an Initialise Variable action (separate as they cannot be included in a Scope) and a Scope action. Within the Scope I fetch a User (top 1, it doesn't matter which one is returned) in order to get the information regarding the Environment. This can then be parsed from the JSON response and the variable is updated appropriately. In my sample below, the condition that sets the variable checks for "sandbox" or "uat" in the Environment url but you can change this as necessary.
If you copy the below (one at a time) to your clipboard and then navigate to the My Clipboard tab when creating a new step you can paste them into Flow using Ctrl+V. They should then appear in the list and can be added to the Flow process.
Initialise Variable
{"id":"5af4e0e6-c433-47cc-b834-4816-3ea209c5","brandColor":"#770BD6","connectionReferences":{"shared_office365":{"connection":{"id":"/providers/Microsoft.PowerApps/apis/shared_office365/connections/shared-office365-2f5078db-85f7-485b-9078-88503139d67d"}},"shared_commondataserviceforapps":{"connection":{"id":"/providers/Microsoft.PowerApps/apis/shared_commondataserviceforapps/connections/shared-commondataser-044a2d24-6760-41d8-98f2-14c3b802818a"}},"shared_commondataserviceforapps_1":{"connection":{"id":"/providers/Microsoft.PowerApps/apis/shared_commondataserviceforapps/connections/shared-commondataser-e23bc044-5322-4dcf-bfc4-921fd213319a"}}},"connectorDisplayName":"Variables","icon":"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzJweCIgaGVpZ2h0PSIzMnB4IiBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCAzMiAzMiIgdmVyc2lvbj0iMS4xIiB2aWV3Qm94PSIwIDAgMzIgMzIiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+DQogPHJlY3Qgd2lkdGg9IjMyIiBoZWlnaHQ9IjMyIiBmaWxsPSIjNzcwQkQ2Ii8+DQogPGcgZmlsbD0iI2ZmZiI+DQogIDxw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ByeT0iLjc3OCIvPg0KICA8ZWxsaXBzZSB0cmFuc2Zvcm09Im1hdHJpeCguMDUzNiAtLjk5ODYgLjk5ODYgLjA1MzYgLTcuNTgzOSAzMC42MjkpIiBjeD0iMTIuMzY2IiBjeT0iMTkuMzE1IiByeD0iLjc3OCIgcnk9Ii43NzgiLz4NCiA8L2c+DQo8L3N2Zz4NCg==","isTrigger":false,"operationName":"Initialize_variable","operationDefinition":{"type":"InitializeVariable","inputs":{"variables":[{"name":"SandboxMode","type":"Boolean","value":false}]},"runAfter":{}}}
Environment Check Scope
{"id":"1432541e-a477-43c5-b2a4-aea2-c7515884","brandColor":"#8C3900","connectionReferences":{"shared_office365":{"connection":{"id":"/providers/Microsoft.PowerApps/apis/shared_office365/connections/shared-office365-2f5078db-85f7-485b-9078-88503139d67d"}},"shared_commondataserviceforapps":{"connection":{"id":"/providers/Microsoft.PowerApps/apis/shared_commondataserviceforapps/connections/shared-commondataser-044a2d24-6760-41d8-98f2-14c3b802818a"}},"shared_commondataserviceforapps_1":{"connection":{"id":"/providers/Microsoft.PowerApps/apis/shared_commondataserviceforapps/connections/shared-commondataser-e23bc044-5322-4dcf-bfc4-921fd213319a"}}},"connectorDisplayName":"Control","icon":"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDMyIDMyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPg0KIDxwYXRoIGQ9Im0wIDBoMzJ2MzJoLTMyeiIgZmlsbD0iIzhDMzkwMCIvPg0KIDxwYXRoIGQ9Im04IDEwaDE2djEyaC0xNnptMTUgMTF2LTEwaC0xNHYxMHptLTItOHY2aC0xMHYtNnptLTEgNXYtNGgtOHY0eiIgZmlsbD0iI2ZmZiIvPg0KPC9zdmc+DQo=","isTrigger":false,"operationName":"Environment_Check","operationDefinition":{"type":"Scope","actions":{"Get_a_User_record":{"type":"OpenApiConnection","inputs":{"host":{"connectionName":"shared_commondataserviceforapps_1","operationId":"ListRecords","apiId":"/providers/Microsoft.PowerApps/apis/shared_commondataserviceforapps"},"parameters":{"entityName":"systemusers","$top":1},"authentication":{"type":"Raw","value":"@json(decodeBase64(triggerOutputs().headers['X-MS-APIM-Tokens']))['$ConnectionKey']"}},"runAfter":{},"description":"We need to fetch a record of some type so we can determine which environment we are in"},"Loop_the_records":{"type":"Foreach","foreach":"@outputs('Get_a_User_record')?['body/value']","actions":{"Parse_for_Environment_value":{"type":"ParseJson","inputs":{"content":"@items('Loop_the_records')","schema":{"type":"object","properties":{"@@odata.id":{"type":"string"}}}},"runAfter":{}},"Check_Environment":{"type":"If","expression":{"or":[{"equals":["@contains(body('Parse_for_Environment_value')?['@odata.id'], 'sandbox')",true]},{"equals":["@contains(body('Parse_for_Environment_value')?['@odata.id'], 'uat')",true]}]},"actions":{"Set_SandboxMode_to_true":{"type":"SetVariable","inputs":{"name":"SandboxMode","value":true},"runAfter":{}}},"runAfter":{"Parse_for_Environment_value":["Succeeded"]},"else":{"actions":{"Set_SandboxMode_to_false":{"type":"SetVariable","inputs":{"name":"SandboxMode","value":false},"runAfter":{}}}},"description":"Check if this is running in DEV or UAT"}},"runAfter":{"Get_a_User_record":["Succeeded"]}}},"runAfter":{"Initialize_variable":["Succeeded"]}}}
This will allow you to determine the Environment that you are running in and branch your Flow as needed.
Hope that helps.