web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Development versions o...
Power Automate
Answered

Development versions of Flows, best practice

(0) ShareShare
ReportReport
Posted on by 31

I've been thinking about how to have Development versions of my Flows. I came up with the following plan, and wondered if anyone had a better idea? A lot of my flows are triggered by when an item is created in SharePoint, so thinking about that:

  • Export my Productive Flows to and import them into a seperate Environment, where I can test without affecting Prod
  • Put a Condition at the start of both Flows (Dev and Prod), to check for myself being the creator of the item in SharePoint
  • If the creator is me, then the Dev version runs
  • If it's not me then the Prod version runs

Would this be a good approach? Wondering what other people do to maintain Dev and Prod versions of their Flows?

 

Many thanks

Categories:
  • Verified answer
    LeeHarris Profile Picture
    1,026 on at

    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+DQogIDxwYXRoIGQ9Ik02Ljc2MywxMy42ODV2LTMuMjA4QzYuNzYzLDguNzQ4LDcuNzYyLDgsMTAsOHYxLjA3Yy0xLDAtMiwwLjMyNS0yLDEuNDA3djMuMTg4ICAgIEM4LDE0LjgzNiw2LjUxMiwxNiw1LjUxMiwxNkM2LjUxMiwxNiw4LDE3LjE2NCw4LDE4LjMzNVYyMS41YzAsMS4wODIsMSwxLjQyOSwyLDEuNDI5VjI0Yy0yLjIzOCwwLTMuMjM4LTAuNzcyLTMuMjM4LTIuNXYtMy4xNjUgICAgYzAtMS4xNDktMC44OTMtMS41MjktMS43NjMtMS41ODV2LTEuNUM1Ljg3LDE1LjE5NCw2Ljc2MywxNC44MzQsNi43NjMsMTMuNjg1eiIvPg0KICA8cGF0aCBkPSJtMjUuMjM4IDEzLjY4NXYtMy4yMDhjMC0xLjcyOS0xLTIuNDc3LTMuMjM4LTIuNDc3djEuMDdjMSAwIDIgMC4zMjUgMiAxLjQwN3YzLjE4OGMwIDEuMTcxIDEuNDg4IDIuMzM1IDIuNDg4IDIuMzM1LTEgMC0yLjQ4OCAxLjE2NC0yLjQ4OCAyLjMzNXYzLjE2NWMwIDEuMDgyLTEg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NTItMS44NTEtMi41NTVsLTAuMjE5LTAuNTc4LTAuMjI3IDAuMzk4Yy0xLjA2MiAxLjgyMy0yLjA3OCAyLjczNC0zLjA0NyAyLjczNC0wLjM2NSAwLTAuNjc1LTAuMDkxLTAuOTMtMC4yNzFsMC45MDYtMC44ODVjMC4xNTYgMC4xNTYgMC4zMzggMC4yMzQgMC41NDcgMC4yMzQgMC41ODggMCAxLjI1LTAuNTk2IDEuOTg0LTEuNzg2bDAuNDA2LTAuNjU4IDAuMTU1LTAuMjU5eiIvPg0KICA8ZWxsaXBzZSB0cmFuc2Zvcm09Im1hdHJpeCguMDUzNiAtLjk5ODYgLjk5ODYgLjA1MzYgNS40OTI1IDMyLjI0NSkiIGN4PSIxOS43NTciIGN5PSIxMy4yMjUiIHJ4PSIuNzc4IiByeT0iLjc3OCIvPg0KICA8ZWxsaXBzZSB0cmFuc2Zvcm09Im1hdHJpeCguMDUzNiAtLjk5ODYgLjk5ODYgLjA1MzYgLTcuNTgzOSAzMC42MjkpIiBjeD0iMTIuMzY2IiBjeT0iMTkuMzE1IiByeD0iLjc3OCIgcnk9Ii43NzgiLz4NCiA8L2c+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.

     

  • Ric835 Profile Picture
    31 on at

    Hi @LeeHarris ,

     

    Thank you for the detailed reply, I will give this a try!

     

    🙂

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 289

#2
11manish Profile Picture

11manish 288 Super User 2026 Season 2

#3
Henil Profile Picture

Henil 125

Last 30 days Overall leaderboard