An Introduction to Copy & Paste in Microsoft Flow

I’ve spent the weekend copying and pasting Flow actions here, there and everywhere! It was glorious! This blog post is for the new Copy & Paste feature that’s currently in preview on Microsoft Flow, it goes into detail on what exactly you can do with it and how you do it! It also shows you how you can set up your own preview environment to play around with the new features.

Preview Environment Setup

To set up your shiny new preview environment, you can do this in three easy steps. Firstly, open the Microsoft Flow Admin Environment website located here:https://admin.flow.microsoft.com/environments and sign in.

Secondly, now you’re in your admin environment, click ‘New Environment’, enter a name and from the ‘Region’ section select ‘Preview (United States)’. You can also join the preview program to get access to early pre-release updates and features from here by ticking the ‘join preview program’ checkbox.

How It Works

The Copy and Paste feature aims to mimic the copy and paste functionality of any product you use. You have something and you want to copy it and finally you then want to paste it to create the copy, simple. How do you then do this with the new functionality being added to Microsoft Flow?

Well, before we jump into how it’s done, we need to focus on the limitations first. At the moment, actions are the supported functionality of copy and paste.

To initiate a ‘copy’ you select the burger (three dots) button on an action and select the ‘Copy to my clipboard’ button at the top of the menu.

You’re unable to copy and paste any triggers, if you attempt to the copy and paste button will be disabled with an information button explaining that they’re working on this, so watch this space!

Now you have the action saved to your clipboard, if you were to paste into word you would see a JSONObject.

JSON Example for the copied action:

    {
       "id": "40791c64-63f7-4026-854a-ac81-315e1e2f",
       "connectionReferences": {},
       "isTrigger": false,
       "operationName": "Initialize_variable",
       "operationDefinition": {
          "type": "InitializeVariable",
          "inputs": {
             "variables": [
                {
                   "name": "Flow Joe Copy Example",
                   "type": "Boolean"
                }
             ]
          },
          "runAfter": {}
       }
    }

You can see the JSON contains an operationDefinition field that lists the action type and then additionally under inputs contains the contents for that action. There is also a flag to see if the copied item is a trigger! You do not need to worry about this too much especially if you are not looking to improve your knowledge around JSON but it’s interesting to see how the data is copied!

Now you can add a new action and select ‘My clipboard’ to select the action you have copied to be pasted. If you were to copy many different actions they will all list here. See below as an example of the variable above copied:

Once you select the item you want to paste in the clipboard it will now appear as a copy of the original action.

Copy & Paste with Parallel Branches and Variables

To use the copy and paste functionality with Parallel Branches, rather than simply clicking ‘add a new action’ you will want to select the ‘+’ sign and select ‘Add a parallel branch’. Then, from here, you can select the item from the ‘My clipboard’ tab and it will be pasted into a parallel branch.

This, however, causes some issues if you’re initializing a variable. The problem is, you can only initialize a variable name once. Therefore, you need to adjust the name in your newly pasted variable to ensure this works, so keep that in mind if you’re using it to cut down on your variable creation time! (See below)

Clearing Your Clipboard

The Microsoft Flow website when refreshed clears your clipboard, so just hit F5!

You can now speed up the process to create your Flows by copying and pasting actions!